fix(ux): remove get item buttons from submitted production plan (#30224)
(cherry picked from commit1af13ca4bf) fix(patch): remove dead links to ProdPlan Item (cherry picked from commitd3e90ed8c8) Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
@@ -189,7 +189,7 @@
|
||||
"label": "Select Items to Manufacture"
|
||||
},
|
||||
{
|
||||
"depends_on": "get_items_from",
|
||||
"depends_on": "eval:doc.get_items_from && doc.docstatus == 0",
|
||||
"fieldname": "get_items",
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Finished Goods for Manufacture"
|
||||
@@ -197,6 +197,7 @@
|
||||
{
|
||||
"fieldname": "po_items",
|
||||
"fieldtype": "Table",
|
||||
"label": "Assembly Items",
|
||||
"no_copy": 1,
|
||||
"options": "Production Plan Item",
|
||||
"reqd": 1
|
||||
@@ -350,6 +351,7 @@
|
||||
"hide_border": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "get_items_from",
|
||||
"fieldname": "sub_assembly_items",
|
||||
"fieldtype": "Table",
|
||||
"label": "Sub Assembly Items",
|
||||
@@ -357,6 +359,7 @@
|
||||
"options": "Production Plan Sub Assembly Item"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.po_items && doc.po_items.length && doc.docstatus == 0",
|
||||
"fieldname": "get_sub_assembly_items",
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Sub Assembly Items"
|
||||
@@ -376,7 +379,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-09-06 18:35:59.642232",
|
||||
"modified": "2022-03-14 03:56:23.209247",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Plan",
|
||||
@@ -397,5 +400,6 @@
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC"
|
||||
"sort_order": "ASC",
|
||||
"states": []
|
||||
}
|
||||
@@ -352,3 +352,4 @@ erpnext.patches.v13_0.update_reserved_qty_closed_wo
|
||||
erpnext.patches.v13_0.amazon_mws_deprecation_warning
|
||||
erpnext.patches.v13_0.set_work_order_qty_in_so_from_mr
|
||||
erpnext.patches.v13_0.update_accounts_in_loan_docs
|
||||
erpnext.patches.v13_0.remove_unknown_links_to_prod_plan_items
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
"""
|
||||
Remove "production_plan_item" field where linked field doesn't exist in tha table.
|
||||
"""
|
||||
frappe.reload_doc("manufacturing", "doctype", "production_plan_item")
|
||||
|
||||
work_order = frappe.qb.DocType("Work Order")
|
||||
pp_item = frappe.qb.DocType("Production Plan Item")
|
||||
|
||||
broken_work_orders = (
|
||||
frappe.qb
|
||||
.from_(work_order)
|
||||
.left_join(pp_item).on(work_order.production_plan_item == pp_item.name)
|
||||
.select(work_order.name)
|
||||
.where(
|
||||
(work_order.docstatus == 0)
|
||||
& (work_order.production_plan_item.notnull())
|
||||
& (work_order.production_plan_item.like("new-production-plan%"))
|
||||
& (pp_item.name.isnull())
|
||||
)
|
||||
).run()
|
||||
|
||||
if not broken_work_orders:
|
||||
return
|
||||
|
||||
broken_work_order_names = [d[0] for d in broken_work_orders]
|
||||
|
||||
(frappe.qb
|
||||
.update(work_order)
|
||||
.set(work_order.production_plan_item, None)
|
||||
.where(work_order.name.isin(broken_work_order_names))
|
||||
).run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user