From cb48404bd24e552d0b8041815966171b354e896f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 2 Oct 2017 11:37:18 +0530 Subject: [PATCH] Revert "Fixes for uom in get_item_details (#10986)" (#11009) This reverts commit 5b58e489a8d29ad7242d8b9bba0da292d85d19b6. --- erpnext/controllers/accounts_controller.py | 3 +++ erpnext/stock/get_item_details.py | 11 +---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index a9677b0e8d..d04143d77d 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -187,6 +187,9 @@ class AccountsController(TransactionBase): if stock_qty != len(get_serial_nos(item.get('serial_no'))): item.set(fieldname, value) + elif fieldname == "conversion_factor" and not item.get("conversion_factor"): + item.set(fieldname, value) + if ret.get("pricing_rule"): # if user changed the discount percentage then set user's discount percentage ? item.set("discount_percentage", ret.get("discount_percentage")) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 539e8a5667..72a83c6c1b 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -164,15 +164,6 @@ def get_basic_details(args, item): warehouse = user_default_warehouse or item.default_warehouse or args.warehouse - #Set the UOM to the Default Sales UOM or Default Purchase UOM if configured in the Item Master - if not args.uom: - if args.get('doctype') in ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice']: - args.uom = item.sales_uom if item.sales_uom else item.stock_uom - elif args.get('doctype') in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']: - args.uom = item.purchase_uom if item.purchase_uom else item.stock_uom - else: - args.uom = item.stock_uom - out = frappe._dict({ "item_code": item.name, "item_name": item.item_name, @@ -187,7 +178,7 @@ def get_basic_details(args, item): "batch_no": None, "item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in item.get("taxes")))), - "uom": args.uom, + "uom": item.stock_uom, "min_order_qty": flt(item.min_order_qty) if args.doctype == "Material Request" else "", "qty": args.qty or 1.0, "stock_qty": args.qty or 1.0,