diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index d04143d77d..a9677b0e8d 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -187,9 +187,6 @@ 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 72a83c6c1b..539e8a5667 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -164,6 +164,15 @@ 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, @@ -178,7 +187,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": item.stock_uom, + "uom": args.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,