Fixes for uom in get_item_details

This commit is contained in:
Nabin Hait 2017-09-29 18:57:41 +05:30
commit 01b96a0e31
2 changed files with 8 additions and 12 deletions

View File

@ -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"))

View File

@ -165,14 +165,13 @@ 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 args.get('doctype') in ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice']:
uom = item.sales_uom if item.sales_uom else item.stock_uom
elif args.get('doctype') in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']:
uom = item.purchase_uom if item.purchase_uom else item.stock_uom
else:
uom = item.stock_uom
args.uom = uom
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,
@ -188,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": 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,