mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-27 22:05:19 +00:00
chore: rename type field to secondary_item_type (#55469)
This commit is contained in:
@@ -499,7 +499,7 @@ class SubcontractingInwardOrder(SubcontractingController):
|
||||
"s_warehouse": secondary_item.warehouse,
|
||||
"stock_uom": secondary_item.stock_uom,
|
||||
"scio_detail": secondary_item.name,
|
||||
"type": secondary_item.type,
|
||||
"secondary_item_type": secondary_item.secondary_item_type,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ class IntegrationTestSubcontractingInwardOrder(ERPNextTestSuite):
|
||||
def test_secondary_items_delivery(self):
|
||||
new_bom = frappe.copy_doc(frappe.get_doc("BOM", "BOM-Basic FG Item-001"))
|
||||
new_bom.secondary_items.append(
|
||||
frappe.new_doc("BOM Secondary Item", item_code="Basic RM 2", qty=1, type="Scrap")
|
||||
frappe.new_doc("BOM Secondary Item", item_code="Basic RM 2", qty=1, secondary_item_type="Scrap")
|
||||
)
|
||||
new_bom.submit()
|
||||
sc_bom = frappe.get_doc("Subcontracting BOM", "SB-0001")
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"column_break_rptg",
|
||||
"type",
|
||||
"secondary_item_type",
|
||||
"reference_name",
|
||||
"column_break_jkzt",
|
||||
"item_code",
|
||||
@@ -97,7 +97,7 @@
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "type",
|
||||
"fieldname": "secondary_item_type",
|
||||
"fieldtype": "Select",
|
||||
"label": "Type",
|
||||
"no_copy": 1,
|
||||
@@ -114,7 +114,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2026-02-27 15:15:40.009957",
|
||||
"modified": "2026-06-01 10:00:00.000000",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Subcontracting",
|
||||
"name": "Subcontracting Inward Order Secondary Item",
|
||||
|
||||
@@ -23,7 +23,7 @@ class SubcontractingInwardOrderSecondaryItem(Document):
|
||||
produced_qty: DF.Float
|
||||
reference_name: DF.Data
|
||||
stock_uom: DF.Link
|
||||
type: DF.Literal["Co-Product", "By-Product", "Scrap", "Additional Finished Good"]
|
||||
secondary_item_type: DF.Literal["Co-Product", "By-Product", "Scrap", "Additional Finished Good"]
|
||||
warehouse: DF.Link
|
||||
# end: auto-generated types
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
self.append(
|
||||
"items",
|
||||
{
|
||||
"type": secondary_item.type,
|
||||
"secondary_item_type": secondary_item.secondary_item_type,
|
||||
"is_legacy_scrap_item": secondary_item.is_legacy,
|
||||
"reference_name": item.name,
|
||||
"item_code": secondary_item.item_code,
|
||||
@@ -448,7 +448,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
|
||||
def remove_secondary_items(self):
|
||||
for item in list(self.items):
|
||||
if item.type or item.is_legacy_scrap_item:
|
||||
if item.secondary_item_type or item.is_legacy_scrap_item:
|
||||
self.remove(item)
|
||||
else:
|
||||
item.secondary_items_cost_per_qty = 0
|
||||
@@ -508,7 +508,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
|
||||
secondary_items_cost_map = {}
|
||||
for item in self.get("items") or []:
|
||||
if item.type or item.is_legacy_scrap_item:
|
||||
if item.secondary_item_type or item.is_legacy_scrap_item:
|
||||
qty = (
|
||||
flt(item.qty)
|
||||
if item.is_legacy_scrap_item
|
||||
@@ -523,7 +523,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
|
||||
total_qty = total_amount = 0
|
||||
for item in self.get("items") or []:
|
||||
if not item.type and not item.is_legacy_scrap_item:
|
||||
if not item.secondary_item_type and not item.is_legacy_scrap_item:
|
||||
if item.qty:
|
||||
if item.name in rm_cost_map:
|
||||
item.rm_supp_cost = rm_cost_map[item.name]
|
||||
@@ -567,7 +567,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
|
||||
def validate_secondary_items(self):
|
||||
for item in self.items:
|
||||
if item.type or item.is_legacy_scrap_item:
|
||||
if item.secondary_item_type or item.is_legacy_scrap_item:
|
||||
if not item.qty:
|
||||
frappe.throw(
|
||||
_("Row #{0}: Secondary Item Qty cannot be zero").format(item.idx),
|
||||
|
||||
@@ -1220,7 +1220,7 @@ class TestSubcontractingReceipt(ERPNextTestSuite):
|
||||
scr.get_secondary_items()
|
||||
|
||||
scr_secondary_items = set(
|
||||
[item.item_code for item in scr.items if item.type or item.is_legacy_scrap_item]
|
||||
[item.item_code for item in scr.items if item.secondary_item_type or item.is_legacy_scrap_item]
|
||||
)
|
||||
self.assertEqual(len(scr.items), 3) # 1 FG Item + 2 Scrap Items
|
||||
self.assertEqual(scr_secondary_items, set(secondary_items))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"field_order": [
|
||||
"item_code",
|
||||
"is_legacy_scrap_item",
|
||||
"type",
|
||||
"secondary_item_type",
|
||||
"column_break_2",
|
||||
"item_name",
|
||||
"section_break_4",
|
||||
@@ -162,12 +162,12 @@
|
||||
"label": "Accepted Qty",
|
||||
"no_copy": 1,
|
||||
"print_width": "100px",
|
||||
"read_only_depends_on": "eval:doc.type || doc.is_legacy_scrap_item",
|
||||
"read_only_depends_on": "eval:doc.secondary_item_type || doc.is_legacy_scrap_item",
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"columns": 1,
|
||||
"depends_on": "eval:!parent.is_return && !doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:!parent.is_return && !doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "rejected_qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
@@ -175,7 +175,7 @@
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"read_only_depends_on": "eval:doc.type || doc.is_legacy_scrap_item",
|
||||
"read_only_depends_on": "eval:doc.secondary_item_type || doc.is_legacy_scrap_item",
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
@@ -234,7 +234,7 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:!doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:!doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "rm_cost_per_qty",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Raw Material Cost Per Qty",
|
||||
@@ -244,7 +244,7 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:!doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:!doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "service_cost_per_qty",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Service Cost Per Qty",
|
||||
@@ -254,7 +254,7 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:!doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:!doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "additional_cost_per_qty",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Additional Cost Per Qty",
|
||||
@@ -278,7 +278,7 @@
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: !parent.is_return && !doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval: !parent.is_return && !doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "rejected_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
@@ -290,7 +290,7 @@
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.__islocal && !doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:!doc.__islocal && !doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "quality_inspection",
|
||||
"fieldtype": "Link",
|
||||
"label": "Quality Inspection",
|
||||
@@ -372,7 +372,7 @@
|
||||
"no_copy": 1,
|
||||
"options": "BOM",
|
||||
"print_hide": 1,
|
||||
"read_only_depends_on": "eval:doc.type || doc.is_legacy_scrap_item"
|
||||
"read_only_depends_on": "eval:doc.secondary_item_type || doc.is_legacy_scrap_item"
|
||||
},
|
||||
{
|
||||
"fetch_from": "item_code.brand",
|
||||
@@ -499,7 +499,7 @@
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.use_serial_batch_fields === 0 || doc.docstatus === 1) && !doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:(doc.use_serial_batch_fields === 0 || doc.docstatus === 1) && !doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "rejected_serial_and_batch_bundle",
|
||||
"fieldtype": "Link",
|
||||
"label": "Rejected Serial and Batch Bundle",
|
||||
@@ -564,7 +564,7 @@
|
||||
"label": "Add Serial / Batch Bundle"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.use_serial_batch_fields === 0 && !doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:doc.use_serial_batch_fields === 0 && !doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "add_serial_batch_for_rejected_qty",
|
||||
"fieldtype": "Button",
|
||||
"label": "Add Serial / Batch No (Rejected Qty)"
|
||||
@@ -578,7 +578,7 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:!doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "landed_cost_voucher_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Landed Cost Voucher Amount",
|
||||
@@ -596,7 +596,7 @@
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"fieldname": "type",
|
||||
"fieldname": "secondary_item_type",
|
||||
"fieldtype": "Select",
|
||||
"label": "Type",
|
||||
"no_copy": 1,
|
||||
@@ -606,7 +606,7 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:!doc.type && !doc.is_legacy_scrap_item",
|
||||
"depends_on": "eval:!doc.secondary_item_type && !doc.is_legacy_scrap_item",
|
||||
"fieldname": "secondary_items_cost_per_qty",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Secondary Items Cost Per Qty",
|
||||
@@ -635,7 +635,7 @@
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2026-03-09 15:11:16.977539",
|
||||
"modified": "2026-06-01 10:00:00.000000",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Subcontracting",
|
||||
"name": "Subcontracting Receipt Item",
|
||||
|
||||
@@ -62,7 +62,7 @@ class SubcontractingReceiptItem(Document):
|
||||
subcontracting_order: DF.Link | None
|
||||
subcontracting_order_item: DF.Data | None
|
||||
subcontracting_receipt_item: DF.Data | None
|
||||
type: DF.Literal["", "Co-Product", "By-Product", "Scrap", "Additional Finished Good"]
|
||||
secondary_item_type: DF.Literal["", "Co-Product", "By-Product", "Scrap", "Additional Finished Good"]
|
||||
use_serial_batch_fields: DF.Check
|
||||
warehouse: DF.Link | None
|
||||
# end: auto-generated types
|
||||
|
||||
Reference in New Issue
Block a user