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 <nabinhait@gmail.com>
(cherry picked from commit 97e3770872)
This commit is contained in:
Diptanil Saha
2025-01-17 17:24:39 +05:30
committed by Mergify
parent afab5be63f
commit 7641627b71
6 changed files with 24 additions and 14 deletions

View File

@@ -37,7 +37,7 @@
"capacity_planning_for_days", "capacity_planning_for_days",
"mins_between_operations", "mins_between_operations",
"other_settings_section", "other_settings_section",
"set_op_cost_and_scrape_from_sub_assemblies", "set_op_cost_and_scrap_from_sub_assemblies",
"column_break_23", "column_break_23",
"make_serial_no_batch_from_work_order" "make_serial_no_batch_from_work_order"
], ],
@@ -202,13 +202,6 @@
"fieldtype": "Check", "fieldtype": "Check",
"label": "Allow Excess Material Transfer" "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", "default": "0",
"depends_on": "eval: doc.material_consumption", "depends_on": "eval: doc.material_consumption",
@@ -243,13 +236,20 @@
"fieldname": "validate_components_quantities_per_bom", "fieldname": "validate_components_quantities_per_bom",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Validate Components and Quantities Per BOM" "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", "icon": "icon-wrench",
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2025-01-09 16:02:23.326763", "modified": "2025-01-13 12:07:03.089977",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Manufacturing Settings", "name": "Manufacturing Settings",

View File

@@ -34,7 +34,7 @@ class ManufacturingSettings(Document):
mins_between_operations: DF.Int mins_between_operations: DF.Int
overproduction_percentage_for_sales_order: DF.Percent overproduction_percentage_for_sales_order: DF.Percent
overproduction_percentage_for_work_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 update_bom_costs_automatically: DF.Check
validate_components_quantities_per_bom: DF.Check validate_components_quantities_per_bom: DF.Check
# end: auto-generated types # end: auto-generated types

View File

@@ -2091,7 +2091,7 @@ class TestWorkOrder(FrappeTestCase):
def test_op_cost_and_scrap_based_on_sub_assemblies(self): def test_op_cost_and_scrap_based_on_sub_assemblies(self):
# Make Sub Assembly BOM 1 # 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 = { items = {
"Test Final FG Item": 0, "Test Final FG Item": 0,
@@ -2132,7 +2132,7 @@ class TestWorkOrder(FrappeTestCase):
for row in se_doc.additional_costs: for row in se_doc.additional_costs:
self.assertEqual(row.amount, 3000) 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( @change_settings(
"Manufacturing Settings", {"material_consumption": 1, "get_rm_cost_from_consumption_entry": 1} "Manufacturing Settings", {"material_consumption": 1, "get_rm_cost_from_consumption_entry": 1}

View File

@@ -387,5 +387,6 @@ erpnext.patches.v15_0.set_is_exchange_gain_loss_in_payment_entry_deductions
erpnext.patches.v15_0.enable_allow_existing_serial_no erpnext.patches.v15_0.enable_allow_existing_serial_no
erpnext.patches.v15_0.update_cc_in_process_statement_of_accounts erpnext.patches.v15_0.update_cc_in_process_statement_of_accounts
erpnext.patches.v15_0.update_asset_status_to_work_in_progress 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.migrate_checkbox_to_select_for_reconciliation_effect
erpnext.patches.v15_0.sync_auto_reconcile_config erpnext.patches.v15_0.sync_auto_reconcile_config

View File

@@ -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",
)

View File

@@ -2040,7 +2040,7 @@ class StockEntry(StockController):
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
if ( 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 self.work_order
and frappe.get_cached_value("Work Order", self.work_order, "use_multi_level_bom") and frappe.get_cached_value("Work Order", self.work_order, "use_multi_level_bom")
): ):
@@ -2847,7 +2847,7 @@ def get_operating_cost_per_unit(work_order=None, bom_no=None):
if ( if (
bom_no bom_no
and frappe.db.get_single_value( 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") and frappe.get_cached_value("Work Order", work_order, "use_multi_level_bom")
): ):