From 41d8b26dd247858271d2994be348ede8709f1f67 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 19 Mar 2025 12:52:34 +0530 Subject: [PATCH 1/3] fix: fetch bom_no when updating items in sales order (cherry picked from commit 508727a57a7248fae0a72b9c521dba7e7dbfdaec) # Conflicts: # erpnext/public/js/utils.js --- erpnext/controllers/accounts_controller.py | 3 +++ erpnext/public/js/utils.js | 16 ++++++++++++++++ erpnext/stock/get_item_details.py | 1 + 3 files changed, 20 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 94b553e2f99..eb483bdb868 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -3706,6 +3706,9 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil if d.get("schedule_date") and parent_doctype == "Purchase Order": child_item.schedule_date = d.get("schedule_date") + if d.get("bom_no") and parent_doctype == "Sales Order": + child_item.bom_no = d.get("bom_no") + if flt(child_item.price_list_rate): if flt(child_item.rate) > flt(child_item.price_list_rate): # if rate is greater than price_list_rate, set margin diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index cd851b57972..36320c787b6 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -692,7 +692,18 @@ erpnext.utils.update_child_items = function (opts) { }, callback: function (r) { if (r.message) { +<<<<<<< HEAD const { qty, price_list_rate: rate, uom, conversion_factor } = r.message; +======= + const { + qty, + price_list_rate: rate, + uom, + conversion_factor, + item_name, + default_bom, + } = r.message; +>>>>>>> 508727a57a (fix: fetch bom_no when updating items in sales order) const row = dialog.fields_dict.trans_items.df.data.find( (doc) => doc.idx == me.doc.idx @@ -703,6 +714,11 @@ erpnext.utils.update_child_items = function (opts) { uom: me.doc.uom || uom, qty: me.doc.qty || qty, rate: me.doc.rate || rate, +<<<<<<< HEAD +======= + item_name: item_name, + bom_no: default_bom, +>>>>>>> 508727a57a (fix: fetch bom_no when updating items in sales order) }); dialog.fields_dict.trans_items.grid.refresh(); } diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index ff87d159e36..2bed71a3e96 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -472,6 +472,7 @@ def get_basic_details(args, item, overwrite_warehouse=True): "weight_per_unit": args.get("weight_per_unit") or item.get("weight_per_unit"), "weight_uom": args.get("weight_uom") or item.get("weight_uom"), "grant_commission": item.get("grant_commission"), + "default_bom": item.default_bom, } ) From e5b28018304ecb4e50dc5392f0f2332e4f5486b4 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 19 Mar 2025 15:25:50 +0530 Subject: [PATCH 2/3] fix: remove duplicate (cherry picked from commit 386df968c2647bfed9a388833e2f9cf7618228f2) # Conflicts: # erpnext/public/js/utils.js --- erpnext/public/js/utils.js | 6 +++++- erpnext/stock/get_item_details.py | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 36320c787b6..d1cc69c6cda 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -701,7 +701,7 @@ erpnext.utils.update_child_items = function (opts) { uom, conversion_factor, item_name, - default_bom, + bom_no, } = r.message; >>>>>>> 508727a57a (fix: fetch bom_no when updating items in sales order) @@ -717,8 +717,12 @@ erpnext.utils.update_child_items = function (opts) { <<<<<<< HEAD ======= item_name: item_name, +<<<<<<< HEAD bom_no: default_bom, >>>>>>> 508727a57a (fix: fetch bom_no when updating items in sales order) +======= + bom_no: bom_no, +>>>>>>> 386df968c2 (fix: remove duplicate) }); dialog.fields_dict.trans_items.grid.refresh(); } diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 2bed71a3e96..ff87d159e36 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -472,7 +472,6 @@ def get_basic_details(args, item, overwrite_warehouse=True): "weight_per_unit": args.get("weight_per_unit") or item.get("weight_per_unit"), "weight_uom": args.get("weight_uom") or item.get("weight_uom"), "grant_commission": item.get("grant_commission"), - "default_bom": item.default_bom, } ) From 38213b31dad108e8881aa48c9f731786a05f25ee Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 19 Mar 2025 15:47:43 +0530 Subject: [PATCH 3/3] chore: fix conflicts --- erpnext/public/js/utils.js | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index d1cc69c6cda..c0126f2c6ee 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -692,18 +692,7 @@ erpnext.utils.update_child_items = function (opts) { }, callback: function (r) { if (r.message) { -<<<<<<< HEAD - const { qty, price_list_rate: rate, uom, conversion_factor } = r.message; -======= - const { - qty, - price_list_rate: rate, - uom, - conversion_factor, - item_name, - bom_no, - } = r.message; ->>>>>>> 508727a57a (fix: fetch bom_no when updating items in sales order) + const { qty, price_list_rate: rate, uom, conversion_factor, bom_no } = r.message; const row = dialog.fields_dict.trans_items.df.data.find( (doc) => doc.idx == me.doc.idx @@ -714,15 +703,7 @@ erpnext.utils.update_child_items = function (opts) { uom: me.doc.uom || uom, qty: me.doc.qty || qty, rate: me.doc.rate || rate, -<<<<<<< HEAD -======= - item_name: item_name, -<<<<<<< HEAD - bom_no: default_bom, ->>>>>>> 508727a57a (fix: fetch bom_no when updating items in sales order) -======= bom_no: bom_no, ->>>>>>> 386df968c2 (fix: remove duplicate) }); dialog.fields_dict.trans_items.grid.refresh(); }