fix: added valuation field type (Float/Currency) in the filter (backport #36866) (#36868)

fix: added valuation field type (Float/Currency) in the filter (#36866)

(cherry picked from commit dea802dc41)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot]
2023-08-29 16:57:59 +05:30
committed by GitHub
parent d2091cc22c
commit 22247cfa17
4 changed files with 29 additions and 6 deletions

View File

@@ -71,6 +71,14 @@ frappe.query_reports["Stock Balance"] = {
"width": "80",
"options": "Warehouse Type"
},
{
"fieldname": "valuation_field_type",
"label": __("Valuation Field Type"),
"fieldtype": "Select",
"width": "80",
"options": "Currency\nFloat",
"default": "Currency"
},
{
"fieldname":"include_uom",
"label": __("Include UOM"),

View File

@@ -430,9 +430,12 @@ class StockBalanceReport(object):
{
"label": _("Valuation Rate"),
"fieldname": "val_rate",
"fieldtype": "Float",
"fieldtype": self.filters.valuation_field_type or "Currency",
"width": 90,
"convertible": "rate",
"options": "Company:company:default_currency"
if self.filters.valuation_field_type == "Currency"
else None,
},
{
"label": _("Company"),

View File

@@ -82,7 +82,15 @@ frappe.query_reports["Stock Ledger"] = {
"label": __("Include UOM"),
"fieldtype": "Link",
"options": "UOM"
}
},
{
"fieldname": "valuation_field_type",
"label": __("Valuation Field Type"),
"fieldtype": "Select",
"width": "80",
"options": "Currency\nFloat",
"default": "Currency"
},
],
"formatter": function (value, row, column, data, default_formatter) {
value = default_formatter(value, row, column, data);

View File

@@ -196,17 +196,21 @@ def get_columns(filters):
{
"label": _("Avg Rate (Balance Stock)"),
"fieldname": "valuation_rate",
"fieldtype": "Float",
"fieldtype": filters.valuation_field_type,
"width": 180,
"options": "Company:company:default_currency",
"options": "Company:company:default_currency"
if filters.valuation_field_type == "Currency"
else None,
"convertible": "rate",
},
{
"label": _("Valuation Rate"),
"fieldname": "in_out_rate",
"fieldtype": "Float",
"fieldtype": filters.valuation_field_type,
"width": 140,
"options": "Company:company:default_currency",
"options": "Company:company:default_currency"
if filters.valuation_field_type == "Currency"
else None,
"convertible": "rate",
},
{