From 07b73b232b3e27b111bf404175b7373a35574a7d Mon Sep 17 00:00:00 2001 From: Diptanil Saha Date: Fri, 17 Jan 2025 17:24:39 +0530 Subject: [PATCH 1/3] fix: fixed typo in manufacturing settings and field rename (#45238) * chore: field rename and patch entry * chore: patch file rename and description improvement --------- Co-authored-by: Nabin Hait --- .../manufacturing_settings.json | 18 +++++++++--------- .../manufacturing_settings.py | 2 +- .../doctype/work_order/test_work_order.py | 8 ++------ erpnext/patches.txt | 8 +++++++- .../rename_manufacturing_settings_field.py | 9 +++++++++ .../stock/doctype/stock_entry/stock_entry.py | 6 ++---- 6 files changed, 30 insertions(+), 21 deletions(-) create mode 100644 erpnext/patches/v15_0/rename_manufacturing_settings_field.py diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json index 50e7ecf427..07854d8807 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json +++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json @@ -37,7 +37,7 @@ "capacity_planning_for_days", "mins_between_operations", "other_settings_section", - "set_op_cost_and_scrape_from_sub_assemblies", + "set_op_cost_and_scrap_from_sub_assemblies", "column_break_23", "make_serial_no_batch_from_work_order" ], @@ -202,13 +202,6 @@ "fieldtype": "Check", "label": "Allow Excess Material Transfer" }, - { - "default": "0", - "description": "In the case of 'Use Multi-Level BOM' in a work order, if the user wishes to add sub-assembly costs to Finished Goods items without using a job card as well the scrap items, then this option needs to be enable.", - "fieldname": "set_op_cost_and_scrape_from_sub_assemblies", - "fieldtype": "Check", - "label": "Set Operating Cost / Scrap Items From Sub-assemblies" - }, { "default": "0", "depends_on": "eval: doc.material_consumption", @@ -243,13 +236,20 @@ "fieldname": "validate_components_quantities_per_bom", "fieldtype": "Check", "label": "Validate Components and Quantities Per BOM" + }, + { + "default": "0", + "description": "To include sub-assembly costs and scrap items in Finished Goods on a work order without using a job card, when the 'Use Multi-Level BOM' option is enabled.", + "fieldname": "set_op_cost_and_scrap_from_sub_assemblies", + "fieldtype": "Check", + "label": "Set Operating Cost / Scrap Items From Sub-assemblies" } ], "icon": "icon-wrench", "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2025-01-09 16:02:23.326763", + "modified": "2025-01-13 12:07:03.089977", "modified_by": "Administrator", "module": "Manufacturing", "name": "Manufacturing Settings", diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py index 5378aa417b..fba1efd3df 100644 --- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py +++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py @@ -34,7 +34,7 @@ class ManufacturingSettings(Document): mins_between_operations: DF.Int overproduction_percentage_for_sales_order: DF.Percent overproduction_percentage_for_work_order: DF.Percent - set_op_cost_and_scrape_from_sub_assemblies: DF.Check + set_op_cost_and_scrap_from_sub_assemblies: DF.Check update_bom_costs_automatically: DF.Check validate_components_quantities_per_bom: DF.Check # end: auto-generated types diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 7901d3f8f4..edbe0a9510 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -2038,9 +2038,7 @@ class TestWorkOrder(FrappeTestCase): def test_op_cost_and_scrap_based_on_sub_assemblies(self): # Make Sub Assembly BOM 1 - frappe.db.set_single_value( - "Manufacturing Settings", "set_op_cost_and_scrape_from_sub_assemblies", 1 - ) + frappe.db.set_single_value("Manufacturing Settings", "set_op_cost_and_scrap_from_sub_assemblies", 1) items = { "Test Final FG Item": 0, @@ -2083,9 +2081,7 @@ class TestWorkOrder(FrappeTestCase): for row in se_doc.additional_costs: self.assertEqual(row.amount, 3000) - frappe.db.set_single_value( - "Manufacturing Settings", "set_op_cost_and_scrape_from_sub_assemblies", 0 - ) + frappe.db.set_single_value("Manufacturing Settings", "set_op_cost_and_scrap_from_sub_assemblies", 0) @change_settings( "Manufacturing Settings", {"material_consumption": 1, "get_rm_cost_from_consumption_entry": 1} diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 3a21d49f78..abf37df222 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -414,4 +414,10 @@ erpnext.patches.v14_0.update_currency_exchange_settings_for_frankfurter erpnext.patches.v15_0.update_task_assignee_email_field_in_asset_maintenance_log erpnext.patches.v14_0.update_stock_uom_in_work_order_item erpnext.patches.v15_0.enable_allow_existing_serial_no -erpnext.patches.v15_0.update_asset_status_to_work_in_progress \ No newline at end of file +erpnext.patches.v15_0.update_cc_in_process_statement_of_accounts +erpnext.patches.v15_0.migrate_old_item_wise_tax_detail_data_format +erpnext.patches.v15_0.refactor_closing_stock_balance #5 +erpnext.patches.v15_0.update_asset_status_to_work_in_progress +erpnext.patches.v15_0.rename_manufacturing_settings_field +erpnext.patches.v15_0.migrate_checkbox_to_select_for_reconciliation_effect +erpnext.patches.v15_0.sync_auto_reconcile_config diff --git a/erpnext/patches/v15_0/rename_manufacturing_settings_field.py b/erpnext/patches/v15_0/rename_manufacturing_settings_field.py new file mode 100644 index 0000000000..af178753a7 --- /dev/null +++ b/erpnext/patches/v15_0/rename_manufacturing_settings_field.py @@ -0,0 +1,9 @@ +from frappe.model.utils.rename_field import rename_field + + +def execute(): + rename_field( + "Manufacturing Settings", + "set_op_cost_and_scrape_from_sub_assemblies", + "set_op_cost_and_scrap_from_sub_assemblies", + ) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 03efd5e30b..11630c5845 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -2032,9 +2032,7 @@ class StockEntry(StockController): from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict if ( - frappe.db.get_single_value( - "Manufacturing Settings", "set_op_cost_and_scrape_from_sub_assemblies" - ) + frappe.db.get_single_value("Manufacturing Settings", "set_op_cost_and_scrap_from_sub_assemblies") and self.work_order and frappe.get_cached_value("Work Order", self.work_order, "use_multi_level_bom") ): @@ -2834,7 +2832,7 @@ def get_operating_cost_per_unit(work_order=None, bom_no=None): if ( bom_no and frappe.db.get_single_value( - "Manufacturing Settings", "set_op_cost_and_scrape_from_sub_assemblies" + "Manufacturing Settings", "set_op_cost_and_scrap_from_sub_assemblies" ) and frappe.get_cached_value("Work Order", work_order, "use_multi_level_bom") ): -- GitLab From bfd822c16179a90d8196b2ae36cae8c0ea966719 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Mon, 20 Jan 2025 10:07:00 +0000 Subject: [PATCH 2/3] fix: patch conflicts --- erpnext/patches.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index abf37df222..daf65e2fa3 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -417,7 +417,6 @@ erpnext.patches.v15_0.enable_allow_existing_serial_no erpnext.patches.v15_0.update_cc_in_process_statement_of_accounts erpnext.patches.v15_0.migrate_old_item_wise_tax_detail_data_format erpnext.patches.v15_0.refactor_closing_stock_balance #5 +erpnext.patches.v15_0.set_is_exchange_gain_loss_in_payment_entry_deductions erpnext.patches.v15_0.update_asset_status_to_work_in_progress -erpnext.patches.v15_0.rename_manufacturing_settings_field erpnext.patches.v15_0.migrate_checkbox_to_select_for_reconciliation_effect -erpnext.patches.v15_0.sync_auto_reconcile_config -- GitLab From e00bfb9a942d9b8a3b7dec61e4201ec2fa4a4bc6 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Tue, 21 Jan 2025 08:35:33 +0000 Subject: [PATCH 3/3] fix: patch registration --- erpnext/patches.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index daf65e2fa3..cc6cef53ad 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -414,9 +414,5 @@ erpnext.patches.v14_0.update_currency_exchange_settings_for_frankfurter erpnext.patches.v15_0.update_task_assignee_email_field_in_asset_maintenance_log erpnext.patches.v14_0.update_stock_uom_in_work_order_item erpnext.patches.v15_0.enable_allow_existing_serial_no -erpnext.patches.v15_0.update_cc_in_process_statement_of_accounts -erpnext.patches.v15_0.migrate_old_item_wise_tax_detail_data_format -erpnext.patches.v15_0.refactor_closing_stock_balance #5 -erpnext.patches.v15_0.set_is_exchange_gain_loss_in_payment_entry_deductions erpnext.patches.v15_0.update_asset_status_to_work_in_progress -erpnext.patches.v15_0.migrate_checkbox_to_select_for_reconciliation_effect +erpnext.patches.v15_0.rename_manufacturing_settings_field \ No newline at end of file -- GitLab