From 816cb8c1410c77a12f568b87e7be93ec0bc7b67f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 1 May 2015 11:09:54 +0530 Subject: [PATCH] Migrate customized precision for newly created total fields --- erpnext/patches/v5_0/taxes_and_totals_in_party_currency.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v5_0/taxes_and_totals_in_party_currency.py b/erpnext/patches/v5_0/taxes_and_totals_in_party_currency.py index 7afa015278..c595f4e0bf 100644 --- a/erpnext/patches/v5_0/taxes_and_totals_in_party_currency.py +++ b/erpnext/patches/v5_0/taxes_and_totals_in_party_currency.py @@ -22,7 +22,8 @@ def update_values(dt, tax_table): frappe.reload_doctype(tax_table) net_total_precision = get_field_precision(frappe.get_meta(dt).get_field("net_total")) - make_property_setter(dt, "base_total", "precision", net_total_precision, "Select") + for field in ("total", "base_total", "base_net_total"): + make_property_setter(dt, field, "precision", net_total_precision, "Select") rate_field_precision = get_field_precision(frappe.get_meta(dt + " Item").get_field("rate")) for field in ("net_rate", "base_net_rate", "net_amount", "base_net_amount", "base_rate", "base_amount"): @@ -38,7 +39,7 @@ def update_values(dt, tax_table): UPDATE `tab{0}` SET - total = net_total, + total = round(net_total, {1}), base_total = round(net_total*conversion_rate, {1}), net_total = round(base_net_total / conversion_rate, {1}), apply_discount_on = "Grand Total"