* 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",
|
"depends_on": "eval:!doc.__islocal",
|
||||||
"fieldname": "download_materials_required",
|
"fieldname": "download_materials_required",
|
||||||
"fieldtype": "Button",
|
"fieldtype": "Button",
|
||||||
"label": "Download Materials Request Plan"
|
"label": "Download Required Materials"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "get_items_for_mr",
|
"fieldname": "get_items_for_mr",
|
||||||
@@ -398,7 +398,7 @@
|
|||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
"fieldname": "download_materials_request_plan_section_section",
|
"fieldname": "download_materials_request_plan_section_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Download Materials Request Plan Section"
|
"label": "Preview Required Materials"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
@@ -439,7 +439,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-02-27 13:34:20.692211",
|
"modified": "2024-12-04 11:55:03.108971",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Production Plan",
|
"name": "Production Plan",
|
||||||
|
|||||||
@@ -44,9 +44,7 @@ class ProductionPlan(Document):
|
|||||||
from erpnext.manufacturing.doctype.material_request_plan_item.material_request_plan_item import (
|
from erpnext.manufacturing.doctype.material_request_plan_item.material_request_plan_item import (
|
||||||
MaterialRequestPlanItem,
|
MaterialRequestPlanItem,
|
||||||
)
|
)
|
||||||
from erpnext.manufacturing.doctype.production_plan_item.production_plan_item import (
|
from erpnext.manufacturing.doctype.production_plan_item.production_plan_item import ProductionPlanItem
|
||||||
ProductionPlanItem,
|
|
||||||
)
|
|
||||||
from erpnext.manufacturing.doctype.production_plan_item_reference.production_plan_item_reference import (
|
from erpnext.manufacturing.doctype.production_plan_item_reference.production_plan_item_reference import (
|
||||||
ProductionPlanItemReference,
|
ProductionPlanItemReference,
|
||||||
)
|
)
|
||||||
@@ -1085,24 +1083,33 @@ def download_raw_materials(doc, warehouses=None):
|
|||||||
frappe.flags.show_qty_in_stock_uom = 1
|
frappe.flags.show_qty_in_stock_uom = 1
|
||||||
items = get_items_for_material_requests(doc, warehouses=warehouses, get_parent_warehouse_data=True)
|
items = get_items_for_material_requests(doc, warehouses=warehouses, get_parent_warehouse_data=True)
|
||||||
|
|
||||||
|
duplicate_item_wh_list = frappe._dict()
|
||||||
|
|
||||||
for d in items:
|
for d in items:
|
||||||
item_list.append(
|
key = (d.get("item_code"), d.get("warehouse"))
|
||||||
[
|
if key in duplicate_item_wh_list:
|
||||||
d.get("item_code"),
|
rm_data = duplicate_item_wh_list[key]
|
||||||
d.get("item_name"),
|
rm_data[12] += d.get("quantity")
|
||||||
d.get("description"),
|
continue
|
||||||
d.get("stock_uom"),
|
|
||||||
d.get("warehouse"),
|
rm_data = [
|
||||||
d.get("required_bom_qty"),
|
d.get("item_code"),
|
||||||
d.get("projected_qty"),
|
d.get("item_name"),
|
||||||
d.get("actual_qty"),
|
d.get("description"),
|
||||||
d.get("ordered_qty"),
|
d.get("stock_uom"),
|
||||||
d.get("planned_qty"),
|
d.get("warehouse"),
|
||||||
d.get("reserved_qty_for_production"),
|
d.get("required_bom_qty"),
|
||||||
d.get("safety_stock"),
|
d.get("projected_qty"),
|
||||||
d.get("quantity"),
|
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"):
|
if not doc.get("for_warehouse"):
|
||||||
row = {"item_code": d.get("item_code")}
|
row = {"item_code": d.get("item_code")}
|
||||||
|
|||||||
Reference in New Issue
Block a user