From aa043fe9617e15ff6f6999e968ca09ec2c68e66f 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 --- 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 f28de3b064..8d5a042a11 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -300,7 +300,7 @@ class BuyingController(StockController, Subcontracting): 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")