mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 04:15:10 +00:00
Merge pull request #51436 from rohitwaghchaure/fixed-github-43596
fix: do not sum quantities for similar items across different operations
This commit is contained in:
@@ -19,6 +19,20 @@ frappe.ui.form.on("BOM", {
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("operation", "items", function () {
|
||||
if (!frm.doc.operations?.length) {
|
||||
frappe.throw(__("Please add Operations first."));
|
||||
}
|
||||
|
||||
let operations = frm.doc.operations.map((d) => d.operation);
|
||||
|
||||
return {
|
||||
filters: {
|
||||
name: ["in", operations],
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("bom_no", "operations", function (doc, cdt, cdn) {
|
||||
let row = locals[cdt][cdn];
|
||||
return {
|
||||
|
||||
@@ -1036,10 +1036,14 @@ class BOM(WebsiteGenerator):
|
||||
return erpnext.get_company_currency(self.company)
|
||||
|
||||
def add_to_cur_exploded_items(self, args):
|
||||
if self.cur_exploded_items.get(args.item_code):
|
||||
self.cur_exploded_items[args.item_code]["stock_qty"] += args.stock_qty
|
||||
key = args.item_code
|
||||
if args.operation:
|
||||
key = (args.item_code, args.operation)
|
||||
|
||||
if self.cur_exploded_items.get(key):
|
||||
self.cur_exploded_items[key]["stock_qty"] += args.stock_qty
|
||||
else:
|
||||
self.cur_exploded_items[args.item_code] = args
|
||||
self.cur_exploded_items[key] = args
|
||||
|
||||
def get_child_exploded_items(self, bom_no, stock_qty, operation=None):
|
||||
"""Add all items from Flat BOM of child BOM"""
|
||||
@@ -1275,7 +1279,7 @@ def get_bom_items_as_dict(
|
||||
):
|
||||
item_dict = {}
|
||||
|
||||
group_by_cond = "group by item_code, stock_uom"
|
||||
group_by_cond = "group by item_code, stock_uom, operation"
|
||||
if frappe.get_cached_value("BOM", bom, "track_semi_finished_goods"):
|
||||
fetch_exploded = 0
|
||||
group_by_cond = "group by item_code, operation_row_id, stock_uom"
|
||||
@@ -1360,6 +1364,9 @@ def get_bom_items_as_dict(
|
||||
if item.operation_row_id:
|
||||
key = (item.item_code, item.operation_row_id)
|
||||
|
||||
if item.operation:
|
||||
key = (item.item_code, item.operation)
|
||||
|
||||
if item.get("is_phantom_item"):
|
||||
data = get_bom_items_as_dict(
|
||||
item.get("bom_no"),
|
||||
|
||||
@@ -147,8 +147,10 @@
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.parenttype == \"Routing\"",
|
||||
"description": "If you want to run operations in parallel, keep the same sequence ID for them.",
|
||||
"fieldname": "sequence_id",
|
||||
"fieldtype": "Int",
|
||||
"in_list_view": 1,
|
||||
"label": "Sequence ID"
|
||||
},
|
||||
{
|
||||
@@ -295,7 +297,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2025-08-12 19:27:20.682797",
|
||||
"modified": "2026-01-01 17:15:59.806874",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "BOM Operation",
|
||||
|
||||
Reference in New Issue
Block a user