fix: hardcoded precision causing decimal issues

(cherry picked from commit 90fd6f2e40)
This commit is contained in:
Rohit Waghchaure
2026-04-07 15:45:34 +05:30
committed by Mergify
parent 7b154c3069
commit e361afb6bc
6 changed files with 13 additions and 13 deletions

View File

@@ -740,7 +740,6 @@
"label": "Valuation Rate", "label": "Valuation Rate",
"no_copy": 1, "no_copy": 1,
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"precision": "6",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
@@ -1008,7 +1007,7 @@
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2026-03-25 18:03:33.522195", "modified": "2026-04-07 15:40:45.687554",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Purchase Invoice Item", "name": "Purchase Invoice Item",

View File

@@ -2887,7 +2887,7 @@ class TestSalesInvoice(ERPNextTestSuite):
si.submit() si.submit()
# Check if adjustment entry is created # Check if adjustment entry is created
self.assertTrue( self.assertFalse(
frappe.db.exists( frappe.db.exists(
"GL Entry", "GL Entry",
{ {

View File

@@ -634,11 +634,11 @@ class SellingController(StockController):
if allow_at_arms_length_price: if allow_at_arms_length_price:
continue continue
rate = flt( rate = flt(flt(d.incoming_rate) * flt(d.conversion_factor or 1.0))
flt(d.incoming_rate, d.precision("incoming_rate")) * d.conversion_factor,
d.precision("rate"), if flt(d.rate, d.precision("incoming_rate")) != flt(
) rate, d.precision("incoming_rate")
if d.rate != rate: ):
d.rate = rate d.rate = rate
frappe.msgprint( frappe.msgprint(
_( _(

View File

@@ -167,8 +167,11 @@ class calculate_taxes_and_totals:
bill_for_rejected_quantity_in_purchase_invoice = frappe.get_single_value( bill_for_rejected_quantity_in_purchase_invoice = frappe.get_single_value(
"Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice" "Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice"
) )
do_not_round_fields = ["valuation_rate", "incoming_rate"]
for item in self.doc.items: for item in self.doc.items:
self.doc.round_floats_in(item) self.doc.round_floats_in(item, do_not_round_fields=do_not_round_fields)
if item.discount_percentage == 100: if item.discount_percentage == 100:
item.rate = 0.0 item.rate = 0.0

View File

@@ -759,7 +759,6 @@
"label": "Incoming Rate", "label": "Incoming Rate",
"no_copy": 1, "no_copy": 1,
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"precision": "6",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
@@ -953,7 +952,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2025-05-31 19:51:32.651562", "modified": "2026-04-07 15:43:20.892151",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Delivery Note Item", "name": "Delivery Note Item",

View File

@@ -735,7 +735,6 @@
"oldfieldname": "valuation_rate", "oldfieldname": "valuation_rate",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"precision": "6",
"print_hide": 1, "print_hide": 1,
"print_width": "80px", "print_width": "80px",
"read_only": 1, "read_only": 1,
@@ -1150,7 +1149,7 @@
"idx": 1, "idx": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2026-02-07 14:42:11.646809", "modified": "2026-04-07 15:40:47.032889",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Purchase Receipt Item", "name": "Purchase Receipt Item",