mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-13 14:41:53 +00:00
fix: require FG / Semi FG Item on operations when tracking semi finished goods
A BOM with track_semi_finished_goods enabled could be saved with no
finished_good on any operation: validate_semi_finished_goods only
checked that one row had 'Is Final Finished Good' set, and a list
containing None passed the emptiness check.
Such a BOM breaks every downstream step. The work order copies the
empty finished_good into its operations, job cards inherit it, and
Make Stock Entry finally fails with 'Item None not found' because the
manufacture entry has no production item.
Derive the finished good where it is unambiguous: an operation that
references a BOM produces that BOM's item, and the final operation
produces the BOM's own item. Otherwise require it on the row, since
each operation's job card books its output through it.
(cherry picked from commit 3497a6a6bf)
This commit is contained in:
@@ -313,6 +313,19 @@ class BOM(WebsiteGenerator):
|
|||||||
|
|
||||||
fg_items = []
|
fg_items = []
|
||||||
for row in self.operations:
|
for row in self.operations:
|
||||||
|
if row.bom_no and not row.finished_good:
|
||||||
|
row.finished_good = frappe.get_cached_value("BOM", row.bom_no, "item")
|
||||||
|
|
||||||
|
if row.is_final_finished_good and not row.finished_good:
|
||||||
|
row.finished_good = self.item
|
||||||
|
|
||||||
|
if not row.finished_good:
|
||||||
|
frappe.throw(
|
||||||
|
_(
|
||||||
|
"Row #{0}: FG / Semi FG Item is required for the operation {1} as 'Track Semi Finished Goods' is enabled."
|
||||||
|
).format(row.idx, bold(row.operation)),
|
||||||
|
)
|
||||||
|
|
||||||
if not row.is_final_finished_good:
|
if not row.is_final_finished_good:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,7 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "FG / Semi FG Item",
|
"label": "FG / Semi FG Item",
|
||||||
|
"mandatory_depends_on": "eval:parent.track_semi_finished_goods === 1",
|
||||||
"options": "Item"
|
"options": "Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -307,7 +308,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2026-05-25 17:15:42.044630",
|
"modified": "2026-08-08 12:00:00.000000",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "BOM Operation",
|
"name": "BOM Operation",
|
||||||
|
|||||||
Reference in New Issue
Block a user