* fix: duplicate required items in the CSV (#44498)
(cherry picked from commit b4534e56e4)
# Conflicts:
# erpnext/manufacturing/doctype/production_plan/production_plan.json
* chore: fix conflicts
---------
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -243,7 +243,7 @@
|
||||
"depends_on": "eval:!doc.__islocal",
|
||||
"fieldname": "download_materials_required",
|
||||
"fieldtype": "Button",
|
||||
"label": "Download Materials Request Plan"
|
||||
"label": "Download Required Materials"
|
||||
},
|
||||
{
|
||||
"fieldname": "get_items_for_mr",
|
||||
@@ -398,7 +398,7 @@
|
||||
"collapsible": 1,
|
||||
"fieldname": "download_materials_request_plan_section_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Download Materials Request Plan Section"
|
||||
"label": "Preview Required Materials"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
@@ -439,7 +439,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2024-02-27 13:34:20.692211",
|
||||
"modified": "2024-12-04 11:55:03.108971",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Plan",
|
||||
@@ -463,4 +463,4 @@
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC",
|
||||
"states": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,7 @@ class ProductionPlan(Document):
|
||||
from erpnext.manufacturing.doctype.material_request_plan_item.material_request_plan_item import (
|
||||
MaterialRequestPlanItem,
|
||||
)
|
||||
from erpnext.manufacturing.doctype.production_plan_item.production_plan_item import (
|
||||
ProductionPlanItem,
|
||||
)
|
||||
from erpnext.manufacturing.doctype.production_plan_item.production_plan_item import ProductionPlanItem
|
||||
from erpnext.manufacturing.doctype.production_plan_item_reference.production_plan_item_reference import (
|
||||
ProductionPlanItemReference,
|
||||
)
|
||||
@@ -1085,24 +1083,33 @@ def download_raw_materials(doc, warehouses=None):
|
||||
frappe.flags.show_qty_in_stock_uom = 1
|
||||
items = get_items_for_material_requests(doc, warehouses=warehouses, get_parent_warehouse_data=True)
|
||||
|
||||
duplicate_item_wh_list = frappe._dict()
|
||||
|
||||
for d in items:
|
||||
item_list.append(
|
||||
[
|
||||
d.get("item_code"),
|
||||
d.get("item_name"),
|
||||
d.get("description"),
|
||||
d.get("stock_uom"),
|
||||
d.get("warehouse"),
|
||||
d.get("required_bom_qty"),
|
||||
d.get("projected_qty"),
|
||||
d.get("actual_qty"),
|
||||
d.get("ordered_qty"),
|
||||
d.get("planned_qty"),
|
||||
d.get("reserved_qty_for_production"),
|
||||
d.get("safety_stock"),
|
||||
d.get("quantity"),
|
||||
]
|
||||
)
|
||||
key = (d.get("item_code"), d.get("warehouse"))
|
||||
if key in duplicate_item_wh_list:
|
||||
rm_data = duplicate_item_wh_list[key]
|
||||
rm_data[12] += d.get("quantity")
|
||||
continue
|
||||
|
||||
rm_data = [
|
||||
d.get("item_code"),
|
||||
d.get("item_name"),
|
||||
d.get("description"),
|
||||
d.get("stock_uom"),
|
||||
d.get("warehouse"),
|
||||
d.get("required_bom_qty"),
|
||||
d.get("projected_qty"),
|
||||
d.get("actual_qty"),
|
||||
d.get("ordered_qty"),
|
||||
d.get("planned_qty"),
|
||||
d.get("reserved_qty_for_production"),
|
||||
d.get("safety_stock"),
|
||||
d.get("quantity"),
|
||||
]
|
||||
|
||||
duplicate_item_wh_list[key] = rm_data
|
||||
item_list.append(rm_data)
|
||||
|
||||
if not doc.get("for_warehouse"):
|
||||
row = {"item_code": d.get("item_code")}
|
||||
|
||||
Reference in New Issue
Block a user