fix: cover case when all material needs to be bought (#29326)

When material request is to be made for purchase qty should be converted
to purchase UOM
This commit is contained in:
Ankush Menat 2022-01-17 22:14:42 +05:30 committed by GitHub
parent 9cd26fbb6a
commit 48f3d53556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -947,10 +947,6 @@ def get_materials_from_other_locations(item, warehouses, new_mr_items, company):
locations = get_available_item_locations(item.get("item_code"), locations = get_available_item_locations(item.get("item_code"),
warehouses, item.get("quantity"), company, ignore_validation=True) warehouses, item.get("quantity"), company, ignore_validation=True)
if not locations:
new_mr_items.append(item)
return
required_qty = item.get("quantity") required_qty = item.get("quantity")
for d in locations: for d in locations:
if required_qty <=0: return if required_qty <=0: return
@ -970,8 +966,8 @@ def get_materials_from_other_locations(item, warehouses, new_mr_items, company):
if required_qty: if required_qty:
stock_uom, purchase_uom = frappe.db.get_value( stock_uom, purchase_uom = frappe.db.get_value(
'Item', 'Item',
item['item_code'], item['item_code'],
['stock_uom', 'purchase_uom'] ['stock_uom', 'purchase_uom']
) )