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

When material request is to be made for purchase qty should be converted
to purchase UOM

(cherry picked from commit 48f3d53556)

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
mergify[bot]
2022-01-17 22:16:41 +05:30
committed by GitHub
parent 5e3f5d8bcc
commit d5d7f67ac2

View File

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