From 1bc3a6d09c8624410d02010789846eba770fb976 Mon Sep 17 00:00:00 2001 From: Christian Anetzberger Date: Sat, 24 Oct 2026 13:04:33 +0000 Subject: [PATCH] Basic functionality --- .../dock/9llleeuuvu/9llleeuuvu.json | 13 +- .../fixtures/custom_html_block.json | 13 + manufacturing_utilities/hooks.py | 23 + .../manufacturing_overview/api.py | 426 ++++++++++++++++++ .../manufacturing_overview/cache.py | 30 ++ .../doctype/__init__.py | 0 .../__init__.py | 0 .../manufacturing_overview_item_group.json | 37 ++ .../manufacturing_overview_item_group.py | 9 + .../__init__.py | 0 .../manufacturing_overview_settings.js | 8 + .../manufacturing_overview_settings.json | 154 +++++++ .../manufacturing_overview_settings.py | 13 + .../test_manufacturing_overview_settings.py | 22 + .../__init__.py | 0 .../manufacturing_overview_warehouse.json | 37 ++ .../manufacturing_overview_warehouse.py | 9 + .../manufacturing_overview.json | 10 +- .../manufacturing_utilities.json | 11 +- 19 files changed, 805 insertions(+), 10 deletions(-) create mode 100644 manufacturing_utilities/fixtures/custom_html_block.json create mode 100644 manufacturing_utilities/manufacturing_overview/api.py create mode 100644 manufacturing_utilities/manufacturing_overview/cache.py create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/__init__.py create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/__init__.py create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/manufacturing_overview_item_group.json create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/manufacturing_overview_item_group.py create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/__init__.py create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.js create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.py create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/test_manufacturing_overview_settings.py create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/__init__.py create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.json create mode 100644 manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.py diff --git a/manufacturing_utilities/dock/9llleeuuvu/9llleeuuvu.json b/manufacturing_utilities/dock/9llleeuuvu/9llleeuuvu.json index 428e1da..626d01a 100644 --- a/manufacturing_utilities/dock/9llleeuuvu/9llleeuuvu.json +++ b/manufacturing_utilities/dock/9llleeuuvu/9llleeuuvu.json @@ -4,8 +4,17 @@ "docstatus": 0, "doctype": "Dock", "idx": 0, - "items": [], - "modified": "2026-10-17 13:39:45.870379", + "items": [ + { + "added": 0, + "hidden": 0, + "icon": "clipboard-list", + "link_to": "Manufacturing Utilities", + "link_type": "Workspace", + "title": "Manufacturing Utilities" + } + ], + "modified": "2026-10-17 14:57:25.999267", "modified_by": "Administrator", "mount_on": "erpnext", "name": "9llleeuuvu", diff --git a/manufacturing_utilities/fixtures/custom_html_block.json b/manufacturing_utilities/fixtures/custom_html_block.json new file mode 100644 index 0000000..c207d1f --- /dev/null +++ b/manufacturing_utilities/fixtures/custom_html_block.json @@ -0,0 +1,13 @@ +[ + { + "docstatus": 0, + "doctype": "Custom HTML Block", + "html": "

Hello from the frontend

\n
\n Loading...\n
\n
", + "modified": "2026-10-17 14:58:45.689239", + "name": "Manufacturing Overview", + "private": 0, + "roles": [], + "script": "frappe.call({\n method: \"manufacturing_utilities.manufacturing_overview.api.hello_world\",\n type: \"GET\"\n}).then((r) => {\n const container = root_element.querySelector(\n \".manufacturing-overview-content\"\n );\n\n container.textContent = r.message;\n});", + "style": null + } +] \ No newline at end of file diff --git a/manufacturing_utilities/hooks.py b/manufacturing_utilities/hooks.py index d1f1ce2..99a9b8a 100644 --- a/manufacturing_utilities/hooks.py +++ b/manufacturing_utilities/hooks.py @@ -167,6 +167,21 @@ app_license = "gpl-3.0" # } # } +doc_events = { + "Sales Order": { + "on_update": "manufacturing_utilities.manufacturing_overview.cache.invalidate_overview_cache", + "on_update_after_submit": "manufacturing_utilities.manufacturing_overview.cache.invalidate_overview_cache", + "on_submit": "manufacturing_utilities.manufacturing_overview.cache.invalidate_overview_cache", + "on_cancel": "manufacturing_utilities.manufacturing_overview.cache.invalidate_overview_cache", + }, + "Work Order": { + "on_update": "manufacturing_utilities.manufacturing_overview.cache.invalidate_overview_cache", + "on_update_after_submit": "manufacturing_utilities.manufacturing_overview.cache.invalidate_overview_cache", + "on_submit": "manufacturing_utilities.manufacturing_overview.cache.invalidate_overview_cache", + "on_cancel": "manufacturing_utilities.manufacturing_overview.cache.invalidate_overview_cache", + }, +} + # Scheduled Tasks # --------------- @@ -277,3 +292,11 @@ app_license = "gpl-3.0" # List of apps whose translatable strings should be excluded from this app's translations. # ignore_translatable_strings_from = [] +fixtures = [ + { + "dt": "Custom HTML Block", + "filters": [ + ["name", "=", "Manufacturing Overview"] + ] + } +] \ No newline at end of file diff --git a/manufacturing_utilities/manufacturing_overview/api.py b/manufacturing_utilities/manufacturing_overview/api.py new file mode 100644 index 0000000..88e34fc --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/api.py @@ -0,0 +1,426 @@ +import frappe +from frappe.utils import flt + +from manufacturing_utilities.manufacturing_overview.cache import ( + get_cached_overview, + set_cached_overview, +) + +@frappe.whitelist(methods=["GET"]) +def get_manufacturing_overview(): + # ------------------------------------------------------------------------- + # Cache + # ------------------------------------------------------------------------- + + cached = get_cached_overview() + + if cached is not None: + return cached + + # ------------------------------------------------------------------------- + # Settings + # ------------------------------------------------------------------------- + + settings = frappe.get_cached_doc("Manufacturing Overview Settings") + + item_groups = [row.item_group for row in settings.item_groups] + warehouses = [row.warehouse for row in settings.warehouse] + maximum_rows = int(settings.maximum_rows or 0) + + if not item_groups: + result = {"items": []} + set_cached_overview(result) + return result + + # ------------------------------------------------------------------------- + # Sales Order Items + # ------------------------------------------------------------------------- + + item_group_placeholders = ", ".join(["%s"] * len(item_groups)) + + query_values = list(item_groups) + limit_clause = "" + + if maximum_rows > 0: + limit_clause = "LIMIT %s" + query_values.append(maximum_rows) + + rows = frappe.db.sql( + f""" + SELECT + soi.name AS sales_order_item, + soi.parent AS sales_order, + soi.item_code, + soi.item_name, + so.customer, + soi.qty, + soi.delivered_qty, + (soi.qty - soi.delivered_qty) AS remaining_qty, + soi.delivery_date, + soi.work_order_qty + FROM `tabSales Order Item` soi + INNER JOIN `tabSales Order` so + ON so.name = soi.parent + INNER JOIN `tabItem` item + ON item.name = soi.item_code + WHERE + so.docstatus = 1 + AND so.status NOT IN ('Closed', 'Completed') + AND soi.delivered_qty < soi.qty + AND item.item_group IN ({item_group_placeholders}) + ORDER BY + soi.delivery_date ASC, + soi.item_code ASC, + soi.name ASC + {limit_clause} + """, + tuple(query_values), + as_dict=True, + ) + + if not rows: + result = {"items": []} + set_cached_overview(result) + return result + + # ------------------------------------------------------------------------- + # Warehouse stock + # ------------------------------------------------------------------------- + + warehouse_stock = {} + + if warehouses: + item_codes = list({row.item_code for row in rows}) + + item_placeholders = ", ".join(["%s"] * len(item_codes)) + warehouse_placeholders = ", ".join(["%s"] * len(warehouses)) + + stock_rows = frappe.db.sql( + f""" + SELECT + item_code, + SUM(actual_qty) AS actual_qty + FROM `tabBin` + WHERE + item_code IN ({item_placeholders}) + AND warehouse IN ({warehouse_placeholders}) + GROUP BY + item_code + """, + tuple(item_codes + warehouses), + as_dict=True, + ) + + warehouse_stock = { + row.item_code: flt(row.actual_qty) + for row in stock_rows + } + + # Earlier delivery dates get first access to available stock. + remaining_stock = warehouse_stock.copy() + + # ------------------------------------------------------------------------- + # Work Orders + # ------------------------------------------------------------------------- + + sales_order_items = list({ + row.sales_order_item + for row in rows + }) + + work_order_rows = frappe.get_all( + "Work Order", + filters={ + "sales_order_item": ["in", sales_order_items], + "docstatus": 1, + }, + fields=[ + "name", + "sales_order_item", + "creation", + ], + order_by="creation desc", + ) + + work_orders = {} + + for work_order in work_order_rows: + # If multiple submitted Work Orders exist, use the newest one + # as the navigation target. + if work_order.sales_order_item not in work_orders: + work_orders[work_order.sales_order_item] = work_order.name + + # ------------------------------------------------------------------------- + # Build response + # ------------------------------------------------------------------------- + + items = [] + + for row in rows: + qty = flt(row.qty) + delivered_qty = flt(row.delivered_qty) + remaining_qty = flt(row.remaining_qty) + work_order_qty = flt(row.work_order_qty) + + current_warehouse_qty = flt( + remaining_stock.get(row.item_code, 0) + ) + + if delivered_qty > 0: + status = "partially_delivered" + + elif current_warehouse_qty >= remaining_qty: + status = "in_warehouse" + + elif work_order_qty > 0: + status = "to_produce" + + else: + status = "no_work_order" + + subcontracting = get_subcontracting_data(rows) + + items.append( + { + "sales_order": row.sales_order, + "sales_order_item": row.sales_order_item, + "work_order": work_orders.get(row.sales_order_item), + "item_code": row.item_code, + "item_name": row.item_name, + "customer": row.customer, + "qty": qty, + "delivered_qty": delivered_qty, + "remaining_qty": remaining_qty, + "delivery_date": row.delivery_date, + "warehouse_qty": current_warehouse_qty, + "work_order_qty": work_order_qty, + "status": status, + "subcontracting": + subcontracting.get( + row.sales_order_item, + [] + ), + } + ) + + # Reserve stock for this position so later Sales Orders cannot + # use the same stock again. + remaining_stock[row.item_code] = max( + current_warehouse_qty - remaining_qty, + 0, + ) + + result = {"items": items} + + # Stock changes are intentionally allowed to remain stale for at most + # 60 seconds. Sales Orders, Work Orders and settings explicitly clear + # this cache. + set_cached_overview( + result, + expires_in_sec=60, + ) + + return result + + + +def get_subcontracting_data(rows): + if not rows: + return {} + + sales_order_items = list({ + row.sales_order_item + for row in rows + }) + + placeholders = ", ".join( + ["%s"] * len(sales_order_items) + ) + + # ------------------------------------------------------------------------- + # Subcontracted Purchase Orders linked to our Sales Order Items + # ------------------------------------------------------------------------- + + purchase_order_items = frappe.db.sql( + f""" + SELECT + poi.name AS purchase_order_item, + poi.sales_order_item, + + poi.parent AS purchase_order, + + poi.item_code, + poi.item_name, + + poi.fg_item, + poi.fg_item_qty, + + poi.qty, + poi.schedule_date, + poi.expected_delivery_date, + + po.supplier, + po.supplier_name, + po.status AS purchase_order_status + + FROM `tabPurchase Order Item` poi + + INNER JOIN `tabPurchase Order` po + ON po.name = poi.parent + + WHERE + poi.sales_order_item IN ({placeholders}) + AND po.docstatus = 1 + AND po.is_subcontracted = 1 + AND po.status NOT IN ('Closed', 'Completed') + """, + tuple(sales_order_items), + as_dict=True, + ) + + if not purchase_order_items: + return {} + + purchase_order_item_names = [ + row.purchase_order_item + for row in purchase_order_items + ] + + poi_placeholders = ", ".join( + ["%s"] * len(purchase_order_item_names) + ) + + # ------------------------------------------------------------------------- + # Subcontracting Orders created from those Purchase Order Items + # ------------------------------------------------------------------------- + + subcontracting_orders = frappe.db.sql( + f""" + SELECT + sco.name AS subcontracting_order, + sco.purchase_order, + sco.supplier, + sco.supplier_name, + sco.schedule_date, + sco.status, + + scoi.purchase_order_item, + scoi.qty, + scoi.received_qty + + FROM `tabSubcontracting Order Item` scoi + + INNER JOIN `tabSubcontracting Order` sco + ON sco.name = scoi.parent + + WHERE + scoi.purchase_order_item IN ({poi_placeholders}) + AND sco.docstatus < 2 + + ORDER BY + sco.creation ASC + """, + tuple(purchase_order_item_names), + as_dict=True, + ) + + sco_by_purchase_order_item = {} + + for row in subcontracting_orders: + sco_by_purchase_order_item.setdefault( + row.purchase_order_item, + [] + ).append(row) + + # ------------------------------------------------------------------------- + # Build lookup keyed by Sales Order Item + # ------------------------------------------------------------------------- + + result = {} + + for poi in purchase_order_items: + sales_order_item = poi.sales_order_item + + result.setdefault( + sales_order_item, + [] + ) + + linked_orders = sco_by_purchase_order_item.get( + poi.purchase_order_item, + [] + ) + + # PO exists, but no Subcontracting Order yet. + if not linked_orders: + result[sales_order_item].append( + { + "purchase_order": poi.purchase_order, + "purchase_order_item": poi.purchase_order_item, + "subcontracting_order": None, + + "supplier": ( + poi.supplier_name + or poi.supplier + ), + + "process": ( + poi.item_name + or poi.item_code + ), + + "qty": flt( + poi.fg_item_qty + or poi.qty + ), + + "delivery_date": ( + poi.expected_delivery_date + or poi.schedule_date + ), + + "status": "To Transfer", + } + ) + + continue + + for sco in linked_orders: + result[sales_order_item].append( + { + "purchase_order": poi.purchase_order, + "purchase_order_item": poi.purchase_order_item, + + "subcontracting_order": + sco.subcontracting_order, + + "supplier": ( + sco.supplier_name + or sco.supplier + ), + + "process": ( + poi.item_name + or poi.item_code + ), + + "qty": flt( + sco.qty + or poi.fg_item_qty + or poi.qty + ), + + "received_qty": + flt(sco.received_qty), + + "delivery_date": ( + sco.schedule_date + or poi.expected_delivery_date + or poi.schedule_date + ), + + "status": sco.status, + } + ) + + return result \ No newline at end of file diff --git a/manufacturing_utilities/manufacturing_overview/cache.py b/manufacturing_utilities/manufacturing_overview/cache.py new file mode 100644 index 0000000..8d0b4e2 --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/cache.py @@ -0,0 +1,30 @@ +import frappe + + +CACHE_KEY = "manufacturing_utilities:manufacturing_overview" +REALTIME_EVENT = "manufacturing_overview_updated" + + +def get_cached_overview(): + return frappe.cache.get_value(CACHE_KEY) + + +def set_cached_overview(data, expires_in_sec=60): + frappe.cache.set_value( + CACHE_KEY, + data, + expires_in_sec=expires_in_sec, + ) + + +def invalidate_overview_cache(doc=None, method=None): + frappe.cache.delete_value(CACHE_KEY) + + frappe.publish_realtime( + REALTIME_EVENT, + { + "doctype": doc.doctype if doc else None, + "name": doc.name if doc else None, + }, + after_commit=True, + ) \ No newline at end of file diff --git a/manufacturing_utilities/manufacturing_overview/doctype/__init__.py b/manufacturing_utilities/manufacturing_overview/doctype/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/__init__.py b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/manufacturing_overview_item_group.json b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/manufacturing_overview_item_group.json new file mode 100644 index 0000000..487f26d --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/manufacturing_overview_item_group.json @@ -0,0 +1,37 @@ +{ + "actions": [], + "allow_bulk_edit": 1, + "allow_rename": 1, + "creation": "2026-10-17 14:28:12.876642", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "item_group" + ], + "fields": [ + { + "fieldname": "item_group", + "fieldtype": "Link", + "in_list_view": 1, + "label": "item_group", + "options": "Item Group", + "reqd": 1 + } + ], + "grid_page_length": 50, + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2026-10-17 14:30:59.514175", + "modified_by": "Administrator", + "module": "Manufacturing Overview", + "name": "Manufacturing Overview Item Group", + "owner": "Administrator", + "permissions": [], + "row_format": "Dynamic", + "rows_threshold_for_grid_search": 20, + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/manufacturing_overview_item_group.py b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/manufacturing_overview_item_group.py new file mode 100644 index 0000000..2563089 --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_item_group/manufacturing_overview_item_group.py @@ -0,0 +1,9 @@ +# Copyright (c) 2026, CAnetzberger Design and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class ManufacturingOverviewItemGroup(Document): + pass diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/__init__.py b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.js b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.js new file mode 100644 index 0000000..cd73114 --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.js @@ -0,0 +1,8 @@ +// Copyright (c) 2026, CAnetzberger Design and contributors +// For license information, please see license.txt + +// frappe.ui.form.on("Manufacturing Overview Settings", { +// refresh(frm) { + +// }, +// }); diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json new file mode 100644 index 0000000..eaf1018 --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json @@ -0,0 +1,154 @@ +{ + "actions": [], + "allow_bulk_edit": 1, + "creation": "2026-10-17 14:14:14.399888", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "general_section", + "enabled", + "refresh_interval", + "column_break_ljoy", + "maximum_rows", + "lookahead_days", + "filter_section", + "item_groups", + "column_break_ogrc", + "warehouse", + "include_child_warehouses", + "view_section", + "show_customer", + "show_item_code", + "show_sales_order", + "show_work_order", + "show_delivery_date" + ], + "fields": [ + { + "fieldname": "general_section", + "fieldtype": "Section Break", + "label": "General" + }, + { + "default": "0", + "fieldname": "enabled", + "fieldtype": "Check", + "label": "Enabled" + }, + { + "default": "60", + "description": "in seconds", + "fieldname": "refresh_interval", + "fieldtype": "Int", + "label": "Refresh Interval" + }, + { + "fieldname": "column_break_ljoy", + "fieldtype": "Column Break" + }, + { + "default": "15", + "description": "0 = unlimited", + "fieldname": "maximum_rows", + "fieldtype": "Int", + "label": "Maximum Rows" + }, + { + "default": "0", + "description": "0 = unlimited", + "fieldname": "lookahead_days", + "fieldtype": "Int", + "label": "Lookahead Days" + }, + { + "fieldname": "filter_section", + "fieldtype": "Section Break", + "label": "Filter" + }, + { + "fieldname": "column_break_ogrc", + "fieldtype": "Column Break" + }, + { + "default": "0", + "fieldname": "warehouse", + "fieldtype": "Table MultiSelect", + "label": "Warehouse", + "options": "Manufacturing Overview Warehouse" + }, + { + "default": "1", + "fieldname": "include_child_warehouses", + "fieldtype": "Check", + "label": "Include Child Warehouses" + }, + { + "fieldname": "view_section", + "fieldtype": "Section Break", + "label": "View" + }, + { + "default": "1", + "fieldname": "show_customer", + "fieldtype": "Check", + "label": "Show Customer" + }, + { + "default": "1", + "fieldname": "show_item_code", + "fieldtype": "Check", + "label": "Show Item Code" + }, + { + "default": "1", + "fieldname": "show_sales_order", + "fieldtype": "Check", + "label": "Show Sales Order" + }, + { + "default": "1", + "fieldname": "show_work_order", + "fieldtype": "Check", + "label": "Show Work Order" + }, + { + "default": "1", + "fieldname": "show_delivery_date", + "fieldtype": "Check", + "label": "Show Delivery Date" + }, + { + "default": "0", + "fieldname": "item_groups", + "fieldtype": "Table MultiSelect", + "label": "Item Groups", + "options": "Manufacturing Overview Item Group" + } + ], + "grid_page_length": 50, + "index_web_pages_for_search": 1, + "issingle": 1, + "links": [], + "modified": "2026-10-17 15:09:18.704248", + "modified_by": "Administrator", + "module": "Manufacturing Overview", + "name": "Manufacturing Overview Settings", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "print": 1, + "read": 1, + "role": "System Manager", + "share": 1, + "write": 1 + } + ], + "row_format": "Dynamic", + "rows_threshold_for_grid_search": 20, + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.py b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.py new file mode 100644 index 0000000..249ad8e --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.py @@ -0,0 +1,13 @@ +# Copyright (c) 2026, CAnetzberger Design and contributors +# For license information, please see license.txt + +from frappe.model.document import Document + +from manufacturing_utilities.manufacturing_overview.cache import ( + invalidate_overview_cache, +) + + +class ManufacturingOverviewSettings(Document): + def on_update(self): + invalidate_overview_cache() \ No newline at end of file diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/test_manufacturing_overview_settings.py b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/test_manufacturing_overview_settings.py new file mode 100644 index 0000000..7261d5c --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/test_manufacturing_overview_settings.py @@ -0,0 +1,22 @@ +# Copyright (c) 2026, CAnetzberger Design and Contributors +# See license.txt + +# import frappe +from frappe.tests import IntegrationTestCase + + +# On IntegrationTestCase, the doctype test records and all +# link-field test record dependencies are recursively loaded +# Use these module variables to add/remove to/from that list +EXTRA_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] +IGNORE_TEST_RECORD_DEPENDENCIES = [] # eg. ["User"] + + + +class IntegrationTestManufacturingOverviewSettings(IntegrationTestCase): + """ + Integration tests for ManufacturingOverviewSettings. + Use this class for testing interactions between multiple components. + """ + + pass diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/__init__.py b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.json b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.json new file mode 100644 index 0000000..446b6b9 --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.json @@ -0,0 +1,37 @@ +{ + "actions": [], + "allow_bulk_edit": 1, + "allow_rename": 1, + "creation": "2026-10-17 14:30:19.168326", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "warehouse" + ], + "fields": [ + { + "fieldname": "warehouse", + "fieldtype": "Link", + "in_list_view": 1, + "label": "warehouse", + "options": "Warehouse", + "reqd": 1 + } + ], + "grid_page_length": 50, + "index_web_pages_for_search": 1, + "istable": 1, + "links": [], + "modified": "2026-10-17 14:30:48.150452", + "modified_by": "Administrator", + "module": "Manufacturing Overview", + "name": "Manufacturing Overview Warehouse", + "owner": "Administrator", + "permissions": [], + "row_format": "Dynamic", + "rows_threshold_for_grid_search": 20, + "sort_field": "creation", + "sort_order": "DESC", + "states": [] +} diff --git a/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.py b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.py new file mode 100644 index 0000000..dc28b92 --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.py @@ -0,0 +1,9 @@ +# Copyright (c) 2026, CAnetzberger Design and contributors +# For license information, please see license.txt + +# import frappe +from frappe.model.document import Document + + +class ManufacturingOverviewWarehouse(Document): + pass diff --git a/manufacturing_utilities/manufacturing_overview/sidebar/manufacturing_overview/manufacturing_overview.json b/manufacturing_utilities/manufacturing_overview/sidebar/manufacturing_overview/manufacturing_overview.json index 29f9819..1335805 100644 --- a/manufacturing_utilities/manufacturing_overview/sidebar/manufacturing_overview/manufacturing_overview.json +++ b/manufacturing_utilities/manufacturing_overview/sidebar/manufacturing_overview/manufacturing_overview.json @@ -11,19 +11,19 @@ "child": 0, "collapsible": 1, "hidden": 0, - "icon": "clipboard-list", + "icon": "setting-gear", "indent": 0, "is_default_module": 0, "keep_closed": 0, - "label": "Overview", - "link_to": "Manufacturing", - "link_type": "Workspace", + "label": "Manufacturing Overview SettingsManufacturing Overview Settings", + "link_to": "Manufacturing Overview Settings", + "link_type": "DocType", "open_in_new_tab": 1, "show_arrow": 0, "type": "Link" } ], - "modified": "2026-10-17 13:41:28.607918", + "modified": "2026-10-17 15:57:49.122018", "modified_by": "Administrator", "module": "Manufacturing Overview", "name": "Manufacturing Overview", diff --git a/manufacturing_utilities/manufacturing_overview/workspace/manufacturing_utilities/manufacturing_utilities.json b/manufacturing_utilities/manufacturing_overview/workspace/manufacturing_utilities/manufacturing_utilities.json index f70f61f..bdbdc70 100644 --- a/manufacturing_utilities/manufacturing_overview/workspace/manufacturing_utilities/manufacturing_utilities.json +++ b/manufacturing_utilities/manufacturing_overview/workspace/manufacturing_utilities/manufacturing_utilities.json @@ -1,8 +1,13 @@ { "charts": [], - "content": "[{\"type\": \"header\", \"data\": {\"text\": \"Welcome to the Manufacturing Utilities workspace\"}}, {\"type\": \"paragraph\", \"data\": {\"text\": \"Click on the \\u22ef menu to edit\"}}]", + "content": "[{\"id\": \"N9JUiq_ZQJ\", \"type\": \"custom_block\", \"data\": {\"custom_block_name\": \"Manufacturing Overview\", \"col\": 12}}]", "creation": "2026-10-17 13:37:40.192516", - "custom_blocks": [], + "custom_blocks": [ + { + "custom_block_name": "Manufacturing Overview", + "label": "Manufacturing Overview" + } + ], "docstatus": 0, "doctype": "Workspace", "for_user": "", @@ -14,7 +19,7 @@ "label": "Manufacturing Utilities", "link_type": "DocType", "links": [], - "modified": "2026-10-17 13:38:45.189884", + "modified": "2026-10-17 14:57:49.758680", "modified_by": "Administrator", "module": "Manufacturing Overview", "name": "Manufacturing Utilities",