mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 07:32:50 +00:00
feat: Service Item and Finished Good Map (#36647)
* feat: new DocType `Service Item and Finished Good Map` * fix(ux): filters for Service Item and Finished Good * fix: validations for Service Item and Finished Good * feat: set FG Item on Service Item selection in PO * refactor: one-to-many mapping between service item and finished goods * feat: auto set Service Item for finished good in PO created from PP * feat: auto set Service Item on Finished Good selection in PO * test: add test case for service item and finished goods map * feat: `BOM` field in `Finished Good Detail` * feat: new DocType `Subcontracting BOM` * fix: filters and validations for Subcontracting BOM * feat: auto select Service Item in PO created from PP * test: add test case for PO service item auto pick * feat: pick BOM from Subcontracting BOM in SCO * feat: auto pick `Service Item` on FG select * refactor: remove DocType `Service Item and Finished Goods Map` and `Finished Good Detail` * feat: fetch FG for Service Item * chore: `linter` * refactor: update `Auto Name` expression for Subcontracting BOM
This commit is contained in:
@@ -673,6 +673,7 @@ class ProductionPlan(Document):
|
||||
|
||||
po.append("items", po_data)
|
||||
|
||||
po.set_service_items_for_finished_goods()
|
||||
po.set_missing_values()
|
||||
po.flags.ignore_mandatory = True
|
||||
po.flags.ignore_validate = True
|
||||
|
||||
@@ -412,11 +412,15 @@ class TestProductionPlan(FrappeTestCase):
|
||||
|
||||
def test_production_plan_for_subcontracting_po(self):
|
||||
from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom
|
||||
from erpnext.subcontracting.doctype.subcontracting_bom.test_subcontracting_bom import (
|
||||
create_subcontracting_bom,
|
||||
)
|
||||
|
||||
bom_tree_1 = {"Test Laptop 1": {"Test Motherboard 1": {"Test Motherboard Wires 1": {}}}}
|
||||
fg_item = "Test Motherboard 1"
|
||||
bom_tree_1 = {"Test Laptop 1": {fg_item: {"Test Motherboard Wires 1": {}}}}
|
||||
create_nested_bom(bom_tree_1, prefix="")
|
||||
|
||||
item_doc = frappe.get_doc("Item", "Test Motherboard 1")
|
||||
item_doc = frappe.get_doc("Item", fg_item)
|
||||
company = "_Test Company"
|
||||
|
||||
item_doc.is_sub_contracted_item = 1
|
||||
@@ -429,6 +433,12 @@ class TestProductionPlan(FrappeTestCase):
|
||||
|
||||
item_doc.save()
|
||||
|
||||
service_item = make_item(properties={"is_stock_item": 0}).name
|
||||
create_subcontracting_bom(
|
||||
finished_good=fg_item,
|
||||
service_item=service_item,
|
||||
)
|
||||
|
||||
plan = create_production_plan(
|
||||
item_code="Test Laptop 1", planned_qty=10, use_multi_level_bom=1, do_not_submit=True
|
||||
)
|
||||
@@ -445,7 +455,8 @@ class TestProductionPlan(FrappeTestCase):
|
||||
self.assertEqual(po_doc.items[0].qty, 10.0)
|
||||
self.assertEqual(po_doc.items[0].fg_item_qty, 10.0)
|
||||
self.assertEqual(po_doc.items[0].fg_item_qty, 10.0)
|
||||
self.assertEqual(po_doc.items[0].fg_item, "Test Motherboard 1")
|
||||
self.assertEqual(po_doc.items[0].fg_item, fg_item)
|
||||
self.assertEqual(po_doc.items[0].item_code, service_item)
|
||||
|
||||
def test_production_plan_combine_subassembly(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user