Skip to content

Commit 7754504

Browse files
rohitwaghchauremergify[bot]
authored andcommitted
fix: hardcoded precision causing decimal issues
(cherry picked from commit 90fd6f2) # Conflicts: # erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json # erpnext/stock/doctype/delivery_note_item/delivery_note_item.json # erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
1 parent 13f4ba1 commit 7754504

6 files changed

Lines changed: 22 additions & 10 deletions

File tree

erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@
731731
"label": "Valuation Rate",
732732
"no_copy": 1,
733733
"options": "Company:company:default_currency",
734-
"precision": "6",
735734
"print_hide": 1,
736735
"read_only": 1
737736
},
@@ -984,7 +983,11 @@
984983
"idx": 1,
985984
"istable": 1,
986985
"links": [],
986+
<<<<<<< HEAD
987987
"modified": "2025-10-14 13:01:54.441511",
988+
=======
989+
"modified": "2026-04-07 15:40:45.687554",
990+
>>>>>>> 90fd6f2e40 (fix: hardcoded precision causing decimal issues)
988991
"modified_by": "Administrator",
989992
"module": "Accounts",
990993
"name": "Purchase Invoice Item",

erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2917,7 +2917,7 @@ def test_internal_transfer_gl_precision_issues(self):
29172917
si.submit()
29182918

29192919
# Check if adjustment entry is created
2920-
self.assertTrue(
2920+
self.assertFalse(
29212921
frappe.db.exists(
29222922
"GL Entry",
29232923
{

erpnext/controllers/selling_controller.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,11 +616,11 @@ def reset_incoming_rate():
616616
if allow_at_arms_length_price:
617617
continue
618618

619-
rate = flt(
620-
flt(d.incoming_rate, d.precision("incoming_rate")) * d.conversion_factor,
621-
d.precision("rate"),
622-
)
623-
if d.rate != rate:
619+
rate = flt(flt(d.incoming_rate) * flt(d.conversion_factor or 1.0))
620+
621+
if flt(d.rate, d.precision("incoming_rate")) != flt(
622+
rate, d.precision("incoming_rate")
623+
):
624624
d.rate = rate
625625
frappe.msgprint(
626626
_(

erpnext/controllers/taxes_and_totals.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,11 @@ def calculate_item_values(self):
186186
bill_for_rejected_quantity_in_purchase_invoice = frappe.get_single_value(
187187
"Buying Settings", "bill_for_rejected_quantity_in_purchase_invoice"
188188
)
189+
190+
do_not_round_fields = ["valuation_rate", "incoming_rate"]
191+
189192
for item in self.doc.items:
190-
self.doc.round_floats_in(item)
193+
self.doc.round_floats_in(item, do_not_round_fields=do_not_round_fields)
191194

192195
if item.discount_percentage == 100:
193196
item.rate = 0.0

erpnext/stock/doctype/delivery_note_item/delivery_note_item.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@
759759
"label": "Incoming Rate",
760760
"no_copy": 1,
761761
"options": "Company:company:default_currency",
762-
"precision": "6",
763762
"print_hide": 1,
764763
"read_only": 1
765764
},
@@ -952,7 +951,11 @@
952951
"index_web_pages_for_search": 1,
953952
"istable": 1,
954953
"links": [],
954+
<<<<<<< HEAD
955955
"modified": "2025-05-31 18:51:32.651562",
956+
=======
957+
"modified": "2026-04-07 15:43:20.892151",
958+
>>>>>>> 90fd6f2e40 (fix: hardcoded precision causing decimal issues)
956959
"modified_by": "Administrator",
957960
"module": "Stock",
958961
"name": "Delivery Note Item",

erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,6 @@
734734
"oldfieldname": "valuation_rate",
735735
"oldfieldtype": "Currency",
736736
"options": "Company:company:default_currency",
737-
"precision": "6",
738737
"print_hide": 1,
739738
"print_width": "80px",
740739
"read_only": 1,
@@ -1149,7 +1148,11 @@
11491148
"idx": 1,
11501149
"istable": 1,
11511150
"links": [],
1151+
<<<<<<< HEAD
11521152
"modified": "2025-10-14 12:59:20.384056",
1153+
=======
1154+
"modified": "2026-04-07 15:40:47.032889",
1155+
>>>>>>> 90fd6f2e40 (fix: hardcoded precision causing decimal issues)
11531156
"modified_by": "Administrator",
11541157
"module": "Stock",
11551158
"name": "Purchase Receipt Item",

0 commit comments

Comments
 (0)