mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
fix: Consider only active BOMs while updating cost via BOM Update Tool (#16753)
This commit is contained in:
@@ -706,8 +706,11 @@ def get_children(doctype, parent=None, is_root=False, **filters):
|
|||||||
|
|
||||||
def get_boms_in_bottom_up_order(bom_no=None):
|
def get_boms_in_bottom_up_order(bom_no=None):
|
||||||
def _get_parent(bom_no):
|
def _get_parent(bom_no):
|
||||||
return frappe.db.sql_list("""select distinct parent from `tabBOM Item`
|
return frappe.db.sql_list("""
|
||||||
where bom_no = %s and docstatus=1 and parenttype='BOM'""", bom_no)
|
select distinct bom_item.parent from `tabBOM Item` bom_item
|
||||||
|
where bom_item.bom_no = %s and bom_item.docstatus=1 and bom_item.parenttype='BOM'
|
||||||
|
and exists(select bom.name from `tabBOM` bom where bom.name=bom_item.parent and bom.is_active=1)
|
||||||
|
""", bom_no)
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
bom_list = []
|
bom_list = []
|
||||||
@@ -715,9 +718,10 @@ def get_boms_in_bottom_up_order(bom_no=None):
|
|||||||
bom_list.append(bom_no)
|
bom_list.append(bom_no)
|
||||||
else:
|
else:
|
||||||
# get all leaf BOMs
|
# get all leaf BOMs
|
||||||
bom_list = frappe.db.sql_list("""select name from `tabBOM` bom where docstatus=1
|
bom_list = frappe.db.sql_list("""select name from `tabBOM` bom
|
||||||
and not exists(select bom_no from `tabBOM Item`
|
where docstatus=1 and is_active=1
|
||||||
where parent=bom.name and ifnull(bom_no, '')!='')""")
|
and not exists(select bom_no from `tabBOM Item`
|
||||||
|
where parent=bom.name and ifnull(bom_no, '')!='')""")
|
||||||
|
|
||||||
while(count < len(bom_list)):
|
while(count < len(bom_list)):
|
||||||
for child_bom in _get_parent(bom_list[count]):
|
for child_bom in _get_parent(bom_list[count]):
|
||||||
|
|||||||
Reference in New Issue
Block a user