From 2a432c22d4c1891518cfd23a1a3028ccfc21fcfc Mon Sep 17 00:00:00 2001 From: marination Date: Tue, 5 Jul 2022 19:43:02 +0530 Subject: [PATCH] fix: Use fallback conversion factor while setting incoming rate for petty purchase - PIs for petty items (that do not need an Item record) are allowed using Item Name field - If a different UOM is used in this case, conversion factor stays 0 and causes an error - Fallback to 1 in `set_incoming_rate` for buying - Selling will need a proper item, so this change is not needed there (cherry picked from commit aa043fe9617e15ff6f6999e968ca09ec2c68e66f) --- erpnext/controllers/buying_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 0a605345662a..64e70b1aef5d 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -299,7 +299,7 @@ def set_incoming_rate(self): raise_error_if_no_rate=False, ) - rate = flt(outgoing_rate * d.conversion_factor, d.precision("rate")) + rate = flt(outgoing_rate * (d.conversion_factor or 1), d.precision("rate")) else: rate = frappe.db.get_value(ref_doctype, d.get(frappe.scrub(ref_doctype)), "rate")