mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-17 08:35:00 +00:00
fix: Returned Qty in Work Order Consumed Materials report
(cherry picked from commit 30d68a31e0)
This commit is contained in:
committed by
Mergify
parent
2d63fc98d0
commit
affa67e74d
@@ -50,7 +50,11 @@ def get_returned_materials(work_orders):
|
||||
|
||||
raw_materials = frappe.get_all(
|
||||
"Stock Entry",
|
||||
fields=["`tabStock Entry Detail`.`item_code`", "`tabStock Entry Detail`.`qty`"],
|
||||
fields=[
|
||||
"`tabStock Entry`.`work_order`",
|
||||
"`tabStock Entry Detail`.`item_code`",
|
||||
"`tabStock Entry Detail`.`qty`",
|
||||
],
|
||||
filters=[
|
||||
["Stock Entry", "is_return", "=", 1],
|
||||
["Stock Entry Detail", "docstatus", "=", 1],
|
||||
@@ -59,12 +63,14 @@ def get_returned_materials(work_orders):
|
||||
)
|
||||
|
||||
for d in raw_materials:
|
||||
raw_materials_qty[d.item_code] += d.qty
|
||||
key = (d.work_order, d.item_code)
|
||||
raw_materials_qty[key] += d.qty
|
||||
|
||||
for row in work_orders:
|
||||
row.returned_qty = 0.0
|
||||
if raw_materials_qty.get(row.raw_material_item_code):
|
||||
row.returned_qty = raw_materials_qty.get(row.raw_material_item_code)
|
||||
key = (row.parent, row.raw_material_item_code)
|
||||
if raw_materials_qty.get(key):
|
||||
row.returned_qty = raw_materials_qty.get(key)
|
||||
|
||||
|
||||
def get_fields():
|
||||
|
||||
Reference in New Issue
Block a user