Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: production plan submission (backport #39846) #39860

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"in_list_view": 1,
"label": "Item Code",
"options": "Item",
"reqd": 1
"reqd": 1,
"search_index": 1
},
{
"fieldname": "item_name",
Expand All @@ -53,7 +54,8 @@
"in_standard_filter": 1,
"label": "For Warehouse",
"options": "Warehouse",
"reqd": 1
"reqd": 1,
"search_index": 1
},
{
"columns": 1,
Expand Down Expand Up @@ -141,7 +143,8 @@
"fieldname": "from_warehouse",
"fieldtype": "Link",
"label": "From Warehouse",
"options": "Warehouse"
"options": "Warehouse",
"search_index": 1
},
{
"fetch_from": "item_code.safety_stock",
Expand Down Expand Up @@ -199,7 +202,7 @@
],
"istable": 1,
"links": [],
"modified": "2023-09-12 12:09:08.358326",
"modified": "2024-02-11 16:21:11.977018",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Material Request Plan Item",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@
"no_copy": 1,
"options": "\nDraft\nSubmitted\nNot Started\nIn Process\nCompleted\nClosed\nCancelled\nMaterial Requested",
"print_hide": 1,
"read_only": 1
"read_only": 1,
"search_index": 1
},
{
"fieldname": "amended_from",
Expand Down Expand Up @@ -436,7 +437,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-12-26 16:31:13.740777",
"modified": "2024-02-11 15:42:47.642481",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1768,23 +1768,23 @@ def get_reserved_qty_for_production_plan(item_code, warehouse):
return reserved_qty_for_production_plan - reserved_qty_for_production


@frappe.request_cache
def get_non_completed_production_plans():
table = frappe.qb.DocType("Production Plan")
child = frappe.qb.DocType("Production Plan Item")

query = (
return (
frappe.qb.from_(table)
.inner_join(child)
.on(table.name == child.parent)
.select(table.name)
.distinct()
.where(
(table.docstatus == 1)
& (table.status.notin(["Completed", "Closed"]))
& (child.planned_qty > child.ordered_qty)
)
).run(as_dict=True)

return list(set([d.name for d in query]))
).run(pluck="name")


def get_raw_materials_of_sub_assembly_items(
Expand Down
5 changes: 3 additions & 2 deletions erpnext/manufacturing/doctype/work_order/work_order.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@
"no_copy": 1,
"options": "Production Plan",
"print_hide": 1,
"read_only": 1
"read_only": 1,
"search_index": 1
},
{
"fieldname": "production_plan_item",
Expand Down Expand Up @@ -592,7 +593,7 @@
"image_field": "image",
"is_submittable": 1,
"links": [],
"modified": "2023-08-11 18:35:49.852069",
"modified": "2024-02-11 15:47:13.454422",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"fieldtype": "Link",
"in_list_view": 1,
"label": "Item Code",
"options": "Item"
"options": "Item",
"search_index": 1
},
{
"fieldname": "source_warehouse",
Expand Down Expand Up @@ -141,7 +142,7 @@
],
"istable": 1,
"links": [],
"modified": "2022-09-28 10:50:43.512562",
"modified": "2024-02-11 15:45:32.318374",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order Item",
Expand Down
Loading