diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index aa3a64c1f7c..5696d69e648 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -1026,7 +1026,7 @@ frappe.tour["BOM"] = [ frappe.ui.form.on("BOM Secondary Item", { valuation_type(frm, cdt, cdn) { const row = locals[cdt][cdn]; - if (row.valuation_type !== "% of FG Cost") { + if (row.valuation_type !== "% of Component Cost") { frappe.model.set_value(cdt, cdn, "cost_allocation_per", 0); } if (row.valuation_type === "Valuation Rate") { diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py index 98ddfbb8942..b743d9c32b9 100644 --- a/erpnext/manufacturing/doctype/bom/bom.py +++ b/erpnext/manufacturing/doctype/bom/bom.py @@ -1092,7 +1092,7 @@ class BOM(WebsiteGenerator): def calculate_secondary_items_costs(self, save=False): """Valuation Rate and Manual rows carry their own cost, deducted from the raw - material cost; the % of FG Cost rows split the remainder by their percentage.""" + material cost; the % of Component Cost rows split the remainder by their percentage.""" total_sm_cost = 0 base_total_sm_cost = 0 precision = self.precision("raw_material_cost") diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py index 23479a96452..b16dc0d5bfe 100644 --- a/erpnext/manufacturing/doctype/bom/test_bom.py +++ b/erpnext/manufacturing/doctype/bom/test_bom.py @@ -462,7 +462,7 @@ class TestBOM(ERPNextTestSuite): "secondary_item_type": "Additional Finished Good", "qty": 1, "cost_allocation_per": 10, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", }, ) @@ -497,7 +497,7 @@ class TestBOM(ERPNextTestSuite): "secondary_item_type": "Scrap", "qty": 1, "cost_allocation_per": 10, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", }, ) self.assertRaises(frappe.ValidationError, bom_doc.save) @@ -570,7 +570,7 @@ class TestBOM(ERPNextTestSuite): "secondary_item_type": "By-Product", "qty": 1, "cost_allocation_per": 10, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", }, ) bom_doc.save() diff --git a/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json b/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json index 9f740752a72..40daf1fcc78 100644 --- a/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json +++ b/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.json @@ -138,7 +138,7 @@ }, { "default": "0", - "depends_on": "eval:doc.valuation_type == '% of FG Cost'", + "depends_on": "eval:doc.valuation_type == '% of Component Cost'", "fieldname": "cost_allocation_per", "fieldtype": "Percent", "label": "Cost Allocation %", @@ -178,11 +178,11 @@ }, { "default": "Valuation Rate", - "description": "Valuation Rate and Manual value this item on its own and deduct that cost from the raw material cost, like the pre-v16 scrap items. % of FG Cost allocates a percentage of the remaining raw material cost.", + "description": "Valuation Rate and Manual value this item on its own and deduct that cost from the raw material cost, like the pre-v16 scrap items. % of Component Cost allocates a percentage of the remaining raw material cost.", "fieldname": "valuation_type", "fieldtype": "Select", "label": "Valuation Type", - "options": "Valuation Rate\n% of FG Cost\nManual", + "options": "Valuation Rate\n% of Component Cost\nManual", "reqd": 1, "show_description_on_click": 1 }, diff --git a/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.py b/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.py index ec2f72247ac..a5fc82dfbd5 100644 --- a/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.py +++ b/erpnext/manufacturing/doctype/bom_secondary_item/bom_secondary_item.py @@ -32,7 +32,7 @@ class BOMSecondaryItem(Document): stock_qty: DF.Float stock_uom: DF.Link | None uom: DF.Link - valuation_type: DF.Literal["Valuation Rate", "% of FG Cost", "Manual"] + valuation_type: DF.Literal["Valuation Rate", "% of Component Cost", "Manual"] # end: auto-generated types pass diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py index 97a1a2faa15..0250643a425 100644 --- a/erpnext/manufacturing/doctype/job_card/test_job_card.py +++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py @@ -1303,7 +1303,7 @@ class TestJobCard(ERPNextTestSuite): "qty": 1, "process_loss_per": 10, "cost_allocation_per": 5, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", "secondary_item_type": "Scrap", }, ) @@ -2645,7 +2645,7 @@ class TestJobCard(ERPNextTestSuite): "secondary_item_type": "Scrap", "qty": 1, "cost_allocation_per": cost_allocation_per, - "valuation_type": "% of FG Cost" if cost_allocation_per else "Valuation Rate", + "valuation_type": "% of Component Cost" if cost_allocation_per else "Valuation Rate", }, ) bom_doc.save() @@ -2701,7 +2701,7 @@ class TestJobCard(ERPNextTestSuite): self.assertEqual(rows[bom_links[0]].qty, 2) self.assertEqual(rows[bom_links[0]].valuation_type, "Valuation Rate") self.assertEqual(rows[bom_links[1]].qty, 3) - self.assertEqual(rows[bom_links[1]].valuation_type, "% of FG Cost") + self.assertEqual(rows[bom_links[1]].valuation_type, "% of Component Cost") @ERPNextTestSuite.change_settings( "Manufacturing Settings", {"overproduction_percentage_for_work_order": 100} diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py index 858b19287ba..385f72bb848 100644 --- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py +++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py @@ -4023,7 +4023,7 @@ def make_bom(**args): "stock_uom": item_doc.stock_uom, "qty": args.scrap_qty or 1, "cost_allocation_per": args.scrap_cost_allocation_per or 10, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", "process_loss_per": args.scrap_process_loss_per or 10, }, ) diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py index 404aab078f8..7bcfb7ed248 100644 --- a/erpnext/manufacturing/doctype/work_order/test_work_order.py +++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py @@ -4789,7 +4789,7 @@ class TestWorkOrder(ERPNextTestSuite): "item_name": scrap_item, "qty": 3, "cost_allocation_per": 25, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", "process_loss_per": 0, }, ) @@ -4838,7 +4838,7 @@ class TestWorkOrder(ERPNextTestSuite): "item_name": scrap_item, "qty": 3, "cost_allocation_per": 25, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", "process_loss_per": 0, }, ) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e00711ccf42..8af83828c17 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -507,3 +507,4 @@ erpnext.patches.v16_0.append_fieldname_to_pos_search_fields erpnext.patches.v16_0.set_secondary_item_valuation_type erpnext.patches.v16_0.add_transaction_roles_to_sms_settings erpnext.patches.v16_0.recalculate_holiday_list_totals +erpnext.patches.v16_0.rename_component_cost_valuation_type diff --git a/erpnext/patches/v16_0/rename_component_cost_valuation_type.py b/erpnext/patches/v16_0/rename_component_cost_valuation_type.py new file mode 100644 index 00000000000..f2c980a17fc --- /dev/null +++ b/erpnext/patches/v16_0/rename_component_cost_valuation_type.py @@ -0,0 +1,15 @@ +import frappe + +DOCTYPES = ("BOM Secondary Item", "Stock Entry Detail", "Subcontracting Receipt Item") + + +def execute(): + """Rename the `% of FG Cost` valuation type: the percentage is of the component cost.""" + for doctype in DOCTYPES: + frappe.db.set_value( + doctype, + {"valuation_type": "% of FG Cost"}, + "valuation_type", + "% of Component Cost", + update_modified=False, + ) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index c1034e69110..b6f865618b3 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -310,7 +310,7 @@ frappe.ui.form.on("Stock Entry", { frm.trigger("toggle_warehouse_fields"); // only BOM-less rows are editable, and they cannot allocate a BOM percentage; - // read-only rows from a BOM still display their stored % of FG Cost + // read-only rows from a BOM still display their stored % of Component Cost frm.fields_dict.items.grid.update_docfield_property("valuation_type", "options", [ "Valuation Rate", "Manual", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 2dbb940a233..9732fe9d607 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1656,7 +1656,7 @@ class StockEntry(StockController, SubcontractingInwardController): def set_bomless_secondary_valuation_types(self): """Secondary rows without a BOM link choose their own costing: valuation rate or manual. - There is no percentage to allocate without a BOM row, so % of FG Cost is rejected.""" + There is no percentage to allocate without a BOM row, so % of Component Cost is rejected.""" for d in self.get("items"): if d.bom_secondary_item: continue @@ -1667,10 +1667,10 @@ class StockEntry(StockController, SubcontractingInwardController): d.set_basic_rate_manually = 0 continue - if d.valuation_type == "% of FG Cost": + if d.valuation_type == "% of Component Cost": frappe.throw( _( - "Row #{0}: % of FG Cost needs a BOM secondary item. Choose Valuation Rate or Manual for {1}." + "Row #{0}: % of Component Cost needs a BOM secondary item. Choose Valuation Rate or Manual for {1}." ).format(d.idx, frappe.bold(d.item_code)) ) diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 0273888ece6..14d65cfb8ff 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -1124,7 +1124,7 @@ class TestStockEntry(ERPNextTestSuite): "secondary_item_type": "By-Product", "qty": 1, "cost_allocation_per": 10, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", }, ) bom_doc.save() @@ -1208,7 +1208,7 @@ class TestStockEntry(ERPNextTestSuite): "secondary_item_type": "By-Product", "qty": 1, "cost_allocation_per": 10, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", }, ) bom_doc.save() @@ -1422,7 +1422,7 @@ class TestStockEntry(ERPNextTestSuite): self.assertEqual(fg_row.basic_amount, 830) # there is no percentage to allocate without a BOM row - manual_row.valuation_type = "% of FG Cost" + manual_row.valuation_type = "% of Component Cost" self.assertRaises(frappe.ValidationError, entry.save) def test_valuation_rate_lookup_without_voucher_no(self): @@ -3348,7 +3348,7 @@ class TestStockEntry(ERPNextTestSuite): "qty": 5, "cost_allocation_per": 25, "process_loss_per": 0, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", }, ) bom.insert() @@ -3410,7 +3410,7 @@ class TestStockEntry(ERPNextTestSuite): "qty": 5, "cost_allocation_per": 0, "process_loss_per": 0, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", }, ) bom.insert() @@ -3497,7 +3497,7 @@ class TestStockEntry(ERPNextTestSuite): "qty": 5, "cost_allocation_per": 25, "process_loss_per": 0, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", }, ) bom.insert() diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index d30910461a6..200892e1283 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -682,7 +682,7 @@ "fieldname": "valuation_type", "fieldtype": "Select", "label": "Valuation Type", - "options": "\nValuation Rate\n% of FG Cost\nManual", + "options": "\nValuation Rate\n% of Component Cost\nManual", "read_only_depends_on": "eval:!doc.secondary_item_type || doc.bom_secondary_item" } ], diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py index 8d8fba25590..05a39324a46 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py @@ -69,7 +69,7 @@ class StockEntryDetail(Document): transferred_qty: DF.Float secondary_item_type: DF.Literal["", "Co-Product", "By-Product", "Scrap", "Additional Finished Good"] uom: DF.Link - valuation_type: DF.Literal["", "Valuation Rate", "% of FG Cost", "Manual"] + valuation_type: DF.Literal["", "Valuation Rate", "% of Component Cost", "Manual"] use_serial_batch_fields: DF.Check valuation_rate: DF.Currency # end: auto-generated types diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py index 3dfa6188b0b..5c4a95ee033 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py @@ -1216,7 +1216,7 @@ class TestSubcontractingReceipt(ERPNextTestSuite): "item_code": percentage_item, "secondary_item_type": "Co-Product", "stock_qty": 1, - "valuation_type": "% of FG Cost", + "valuation_type": "% of Component Cost", "cost_allocation_per": 10, }, ) diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json index a4d88f0c435..ec7cb78af70 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json +++ b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json @@ -623,7 +623,7 @@ "fieldname": "valuation_type", "fieldtype": "Select", "label": "Valuation Type", - "options": "\nValuation Rate\n% of FG Cost\nManual", + "options": "\nValuation Rate\n% of Component Cost\nManual", "read_only": 1 }, { diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.py b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.py index 46c710afb48..03da2a50f5f 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.py @@ -64,7 +64,7 @@ class SubcontractingReceiptItem(Document): subcontracting_receipt_item: DF.Data | None secondary_item_type: DF.Literal["", "Co-Product", "By-Product", "Scrap", "Additional Finished Good"] use_serial_batch_fields: DF.Check - valuation_type: DF.Literal["", "Valuation Rate", "% of FG Cost", "Manual"] + valuation_type: DF.Literal["", "Valuation Rate", "% of Component Cost", "Manual"] warehouse: DF.Link | None # end: auto-generated types