fix: Conversion factor error for invoices without item code (petty expenses) (#32714)
* fix: Set default uom conversion factor to 1 for invoices * chore: set default conversion_factor as 1 * chore: remove print statements
This commit is contained in:
parent
123920d0bc
commit
617518389a
@ -890,7 +890,7 @@
|
|||||||
"idx": 1,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-11-02 12:53:12.693217",
|
"modified": "2022-12-28 16:17:33.484531",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice Item",
|
"name": "Sales Invoice Item",
|
||||||
|
@ -584,7 +584,12 @@ class AccountsController(TransactionBase):
|
|||||||
if bool(uom) != bool(stock_uom): # xor
|
if bool(uom) != bool(stock_uom): # xor
|
||||||
item.stock_uom = item.uom = uom or stock_uom
|
item.stock_uom = item.uom = uom or stock_uom
|
||||||
|
|
||||||
item.conversion_factor = get_uom_conv_factor(item.get("uom"), item.get("stock_uom"))
|
# UOM cannot be zero so substitute as 1
|
||||||
|
item.conversion_factor = (
|
||||||
|
get_uom_conv_factor(item.get("uom"), item.get("stock_uom"))
|
||||||
|
or item.get("conversion_factor")
|
||||||
|
or 1
|
||||||
|
)
|
||||||
|
|
||||||
if self.doctype == "Purchase Invoice":
|
if self.doctype == "Purchase Invoice":
|
||||||
self.set_expense_account(for_validate)
|
self.set_expense_account(for_validate)
|
||||||
|
Loading…
Reference in New Issue
Block a user