From b64c65de003c42652b521cceb22fe6405c6c9504 Mon Sep 17 00:00:00 2001 From: Christian Anetzberger Date: Sat, 14 Nov 2026 14:42:02 +0000 Subject: [PATCH] Updated Translations, Added PRO in Overview --- manufacturing_utilities/locale/de.po | 91 +++++++++++++++++-- manufacturing_utilities/locale/main.pot | 84 ++++++++++++++++- .../manufacturing_overview/api.py | 61 +++++++------ .../manufacturing_overview/cache.py | 39 ++++++-- .../manufacturing_overview/translations.py | 34 +++++++ 5 files changed, 264 insertions(+), 45 deletions(-) create mode 100644 manufacturing_utilities/manufacturing_overview/translations.py diff --git a/manufacturing_utilities/locale/de.po b/manufacturing_utilities/locale/de.po index 95ed7dc..70bb414 100644 --- a/manufacturing_utilities/locale/de.po +++ b/manufacturing_utilities/locale/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Manufacturing Utilities VERSION\n" "Report-Msgid-Bugs-To: info@canetzberger.design\n" -"POT-Creation-Date: 2026-11-02 19:20+0000\n" +"POT-Creation-Date: 2026-11-14 14:32+0000\n" "PO-Revision-Date: 2026-11-02 19:11+0000\n" "Last-Translator: info@canetzberger.design\n" "Language: de\n" @@ -33,6 +33,10 @@ msgstr "Menge hinzufügen" msgid "Also Print Warehouse Labels" msgstr "Lageretiketten ebenfalls drucken" +#: manufacturing_utilities/manufacturing_overview/translations.py:12 +msgid "Behind schedule" +msgstr "Überfällig" + #: manufacturing_utilities/label_composer/api.py:494 #, python-brace-format msgid "CUPS printer queue {0} was not found" @@ -66,6 +70,10 @@ msgstr "Prüfen Sie die CUPS-Warteschlange, bevor Sie es erneut versuchen. Einig msgid "Complete the quantities to see a preview." msgstr "Vervollständigen Sie die Mengenangaben, um eine Vorschau anzuzeigen." +#: manufacturing_utilities/manufacturing_overview/translations.py:26 +msgid "Completed" +msgstr "Abgeschlossen" + #: manufacturing_utilities/label_composer/api.py:118 msgid "Configured Print Format not found" msgstr "Das konfigurierte Druckformat wurde nicht gefunden" @@ -100,6 +108,10 @@ msgstr "Standarddrucker" msgid "Delivery Date" msgstr "Lieferdatum" +#: manufacturing_utilities/manufacturing_overview/translations.py:21 +msgid "Draft" +msgstr "Entwurf" + #. Label of the enabled (Check) field in DocType 'Label Composer Template' #. Label of the enabled (Check) field in DocType 'Manufacturing Overview #. Settings' @@ -116,6 +128,10 @@ msgstr "Geben Sie gültige Mengen und Etikettenanzahlen ein." msgid "Exceeds document quantity" msgstr "Überschreitet die Belegmenge" +#: manufacturing_utilities/manufacturing_overview/translations.py:33 +msgid "Failed to load Manufacturing Overview." +msgstr "Die Fertigungsübersicht konnte nicht geladen werden." + #. Label of the filter_section (Section Break) field in DocType 'Manufacturing #. Overview Settings' #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json:66 @@ -169,6 +185,10 @@ msgstr "HTML" msgid "HTML preview failed. Check the server error log." msgstr "Die HTML-Vorschau konnte nicht erstellt werden. Prüfen Sie das Fehlerprotokoll des Servers." +#: manufacturing_utilities/manufacturing_overview/translations.py:17 +msgid "In Warehouse" +msgstr "Auf Lager" + #. Label of the include_child_warehouses (Check) field in DocType #. 'Manufacturing Overview Settings' #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json:83 @@ -316,6 +336,10 @@ msgstr "Anmeldung erforderlich" msgid "Lookahead Days" msgstr "Vorschauzeitraum in Tagen" +#: manufacturing_utilities/manufacturing_overview/translations.py:9 +msgid "Manufacturing" +msgstr "Fertigung" + #. Title of a Sidebar #: manufacturing_utilities/manufacturing_overview/sidebar/manufacturing_overview/manufacturing_overview.json:32 msgid "Manufacturing Overview" @@ -329,12 +353,12 @@ msgstr "Artikelgruppe der Fertigungsübersicht" #. Name of a DocType #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json:135 msgid "Manufacturing Overview Settings" -msgstr "Einstellungen der Fertigungsübersicht" +msgstr "Einstellungen Produktionsübersicht" #. Label of a Sidebar Item #: manufacturing_utilities/manufacturing_overview/sidebar/manufacturing_overview/manufacturing_overview.json:18 -msgid "Manufacturing Overview SettingsManufacturing Overview Settings" -msgstr "Einstellungen der FertigungsübersichtEinstellungen der Fertigungsübersicht" +msgid "Manufacturing Overview Settings" +msgstr "Einstellungen Fertigungsübersicht" #. Name of a DocType #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.json:29 @@ -344,12 +368,16 @@ msgstr "Lager der Fertigungsübersicht" #. Name of a Workspace #: manufacturing_utilities/manufacturing_overview/workspace/manufacturing_utilities/manufacturing_utilities.json:19 msgid "Manufacturing Utilities" -msgstr "Fertigungshilfsmittel" +msgstr "Produktionsübersicht" #: manufacturing_utilities/public/js/label_composer.js:795 msgid "Matches document quantity" msgstr "Entspricht der Belegmenge" +#: manufacturing_utilities/manufacturing_overview/translations.py:23 +msgid "Material Transferred" +msgstr "Material umgebucht" + #. Label of the maximum_rows (Int) field in DocType 'Manufacturing Overview #. Settings' #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json:54 @@ -364,6 +392,14 @@ msgstr "Keine Vorlage für die Etikettengestaltung konfiguriert" msgid "No Print Format configured" msgstr "Kein Druckformat konfiguriert" +#: manufacturing_utilities/manufacturing_overview/translations.py:29 +msgid "No Purchase Order" +msgstr "Keine Bestellung" + +#: manufacturing_utilities/manufacturing_overview/translations.py:19 +msgid "No Work Order" +msgstr "Kein Fertigungsauftrag" + #: manufacturing_utilities/label_composer/api.py:115 msgid "No default printer configured" msgstr "Kein Standarddrucker konfiguriert" @@ -372,6 +408,10 @@ msgstr "Kein Standarddrucker konfiguriert" msgid "No document selected" msgstr "Kein Beleg ausgewählt" +#: manufacturing_utilities/manufacturing_overview/translations.py:32 +msgid "No manufacturing items found." +msgstr "Keine Fertigungsartikel gefunden." + #: manufacturing_utilities/public/js/label_composer.js:719 #: manufacturing_utilities/public/js/label_composer.js:1640 msgid "Number of Labels" @@ -398,14 +438,34 @@ msgstr "Papierhöhe (mm)" msgid "Paper Width (mm)" msgstr "Papierbreite (mm)" +#: manufacturing_utilities/manufacturing_overview/translations.py:24 +msgid "Partial Material Transferred" +msgstr "Material teilweise umgebucht" + #: manufacturing_utilities/public/js/label_composer.js:799 msgid "Partial quantity" msgstr "Teilmenge" +#: manufacturing_utilities/manufacturing_overview/translations.py:16 +msgid "Partially Delivered" +msgstr "Teilweise geliefert" + +#: manufacturing_utilities/manufacturing_overview/translations.py:25 +msgid "Partially Received" +msgstr "Teilweise erhalten" + #: manufacturing_utilities/public/js/label_composer.js:769 msgid "Parts" msgstr "Teile" +#: manufacturing_utilities/manufacturing_overview/translations.py:27 +msgid "Planned" +msgstr "Geplant" + +#: manufacturing_utilities/manufacturing_overview/translations.py:30 +msgid "Planned subcontracting" +msgstr "Geplanter Unterauftrag" + #: manufacturing_utilities/public/js/label_composer.js:1748 msgid "Preparing preview..." msgstr "Vorschau wird vorbereitet..." @@ -513,6 +573,10 @@ msgstr "Quelle" msgid "Source Item" msgstr "Quellartikel" +#: manufacturing_utilities/manufacturing_overview/translations.py:10 +msgid "Subcontracting" +msgstr "Unterauftrag" + #. Label of the supplier (Data) field in DocType 'Label Composer Template' #: manufacturing_utilities/label_composer/doctype/label_composer_template/label_composer_template.json:79 #: manufacturing_utilities/public/js/label_composer.js:1598 @@ -569,6 +633,18 @@ msgstr "Dieses Etikett ist noch nicht konfiguriert." msgid "This label template is disabled" msgstr "Diese Etikettenvorlage ist deaktiviert" +#: manufacturing_utilities/manufacturing_overview/translations.py:18 +msgid "To Produce" +msgstr "Zu fertigen" + +#: manufacturing_utilities/manufacturing_overview/translations.py:22 +msgid "To Transfer" +msgstr "Umzubuchen" + +#: manufacturing_utilities/manufacturing_overview/translations.py:13 +msgid "Today" +msgstr "Heute" + #: manufacturing_utilities/label_composer/api.py:69 msgid "Too many label fields" msgstr "Zu viele Etikettenfelder" @@ -587,6 +663,10 @@ msgstr "Zu viele Druckgruppen (maximal {0})" msgid "Unknown label type" msgstr "Unbekannter Etikettentyp" +#: manufacturing_utilities/manufacturing_overview/translations.py:14 +msgid "Upcoming" +msgstr "Anstehend" + #: manufacturing_utilities/public/js/label_composer.js:1204 msgid "Updating preview..." msgstr "Vorschau wird aktualisiert..." @@ -642,4 +722,3 @@ msgstr "pycups ist auf dem Frappe-Server nicht installiert" #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_warehouse/manufacturing_overview_warehouse.json:17 msgid "warehouse" msgstr "Lager" - diff --git a/manufacturing_utilities/locale/main.pot b/manufacturing_utilities/locale/main.pot index 78192bc..43162e3 100644 --- a/manufacturing_utilities/locale/main.pot +++ b/manufacturing_utilities/locale/main.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Manufacturing Utilities VERSION\n" "Report-Msgid-Bugs-To: info@canetzberger.design\n" -"POT-Creation-Date: 2026-11-02 19:20+0000\n" -"PO-Revision-Date: 2026-11-02 19:20+0000\n" +"POT-Creation-Date: 2026-11-14 14:32+0000\n" +"PO-Revision-Date: 2026-11-14 14:32+0000\n" "Last-Translator: info@canetzberger.design\n" "Language-Team: info@canetzberger.design\n" "MIME-Version: 1.0\n" @@ -32,6 +32,10 @@ msgstr "" msgid "Also Print Warehouse Labels" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:12 +msgid "Behind schedule" +msgstr "" + #: manufacturing_utilities/label_composer/api.py:494 #, python-brace-format msgid "CUPS printer queue {0} was not found" @@ -65,6 +69,10 @@ msgstr "" msgid "Complete the quantities to see a preview." msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:26 +msgid "Completed" +msgstr "" + #: manufacturing_utilities/label_composer/api.py:118 msgid "Configured Print Format not found" msgstr "" @@ -99,6 +107,10 @@ msgstr "" msgid "Delivery Date" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:21 +msgid "Draft" +msgstr "" + #. Label of the enabled (Check) field in DocType 'Label Composer Template' #. Label of the enabled (Check) field in DocType 'Manufacturing Overview #. Settings' @@ -115,6 +127,10 @@ msgstr "" msgid "Exceeds document quantity" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:33 +msgid "Failed to load Manufacturing Overview." +msgstr "" + #. Label of the filter_section (Section Break) field in DocType 'Manufacturing #. Overview Settings' #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json:66 @@ -168,6 +184,10 @@ msgstr "" msgid "HTML preview failed. Check the server error log." msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:17 +msgid "In Warehouse" +msgstr "" + #. Label of the include_child_warehouses (Check) field in DocType #. 'Manufacturing Overview Settings' #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json:83 @@ -315,6 +335,10 @@ msgstr "" msgid "Lookahead Days" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:9 +msgid "Manufacturing" +msgstr "" + #. Title of a Sidebar #: manufacturing_utilities/manufacturing_overview/sidebar/manufacturing_overview/manufacturing_overview.json:32 msgid "Manufacturing Overview" @@ -349,6 +373,10 @@ msgstr "" msgid "Matches document quantity" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:23 +msgid "Material Transferred" +msgstr "" + #. Label of the maximum_rows (Int) field in DocType 'Manufacturing Overview #. Settings' #: manufacturing_utilities/manufacturing_overview/doctype/manufacturing_overview_settings/manufacturing_overview_settings.json:54 @@ -363,6 +391,14 @@ msgstr "" msgid "No Print Format configured" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:29 +msgid "No Purchase Order" +msgstr "" + +#: manufacturing_utilities/manufacturing_overview/translations.py:19 +msgid "No Work Order" +msgstr "" + #: manufacturing_utilities/label_composer/api.py:115 msgid "No default printer configured" msgstr "" @@ -371,6 +407,10 @@ msgstr "" msgid "No document selected" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:32 +msgid "No manufacturing items found." +msgstr "" + #: manufacturing_utilities/public/js/label_composer.js:719 #: manufacturing_utilities/public/js/label_composer.js:1640 msgid "Number of Labels" @@ -397,14 +437,34 @@ msgstr "" msgid "Paper Width (mm)" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:24 +msgid "Partial Material Transferred" +msgstr "" + #: manufacturing_utilities/public/js/label_composer.js:799 msgid "Partial quantity" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:16 +msgid "Partially Delivered" +msgstr "" + +#: manufacturing_utilities/manufacturing_overview/translations.py:25 +msgid "Partially Received" +msgstr "" + #: manufacturing_utilities/public/js/label_composer.js:769 msgid "Parts" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:27 +msgid "Planned" +msgstr "" + +#: manufacturing_utilities/manufacturing_overview/translations.py:30 +msgid "Planned subcontracting" +msgstr "" + #: manufacturing_utilities/public/js/label_composer.js:1748 msgid "Preparing preview..." msgstr "" @@ -512,6 +572,10 @@ msgstr "" msgid "Source Item" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:10 +msgid "Subcontracting" +msgstr "" + #. Label of the supplier (Data) field in DocType 'Label Composer Template' #: manufacturing_utilities/label_composer/doctype/label_composer_template/label_composer_template.json:79 #: manufacturing_utilities/public/js/label_composer.js:1598 @@ -568,6 +632,18 @@ msgstr "" msgid "This label template is disabled" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:18 +msgid "To Produce" +msgstr "" + +#: manufacturing_utilities/manufacturing_overview/translations.py:22 +msgid "To Transfer" +msgstr "" + +#: manufacturing_utilities/manufacturing_overview/translations.py:13 +msgid "Today" +msgstr "" + #: manufacturing_utilities/label_composer/api.py:69 msgid "Too many label fields" msgstr "" @@ -586,6 +662,10 @@ msgstr "" msgid "Unknown label type" msgstr "" +#: manufacturing_utilities/manufacturing_overview/translations.py:14 +msgid "Upcoming" +msgstr "" + #: manufacturing_utilities/public/js/label_composer.js:1204 msgid "Updating preview..." msgstr "" diff --git a/manufacturing_utilities/manufacturing_overview/api.py b/manufacturing_utilities/manufacturing_overview/api.py index 7a106bc..a07a25c 100644 --- a/manufacturing_utilities/manufacturing_overview/api.py +++ b/manufacturing_utilities/manufacturing_overview/api.py @@ -82,11 +82,11 @@ def get_manufacturing_overview(): else None ) - # A Planned End Date means that this Work Order - # requires some form of subcontracting. + # A Planned End Date means subcontracting + # is expected. # - # If purchasing has not yet created a PO, still - # show the subcontracting planning card. + # Even if purchasing has not created a PO + # yet, show a placeholder card. if ( planned_end_date and not subcontracting_rows @@ -94,7 +94,6 @@ def get_manufacturing_overview(): subcontracting_rows.append( get_planned_subcontracting_entry( row=row, - work_order=work_order, ) ) @@ -114,8 +113,11 @@ def get_manufacturing_overview(): } ) - # Important: - # maximum_rows is applied AFTER effective-date sorting. + # Sort by the operationally relevant date: + # + # - customer delivery date normally + # - planned end date while subcontracting + # material still needs to leave prepared_rows.sort( key=overview_sort_key ) @@ -327,6 +329,10 @@ def get_work_orders( if not sales_order_items: return {} + # Draft + Submitted Work Orders are useful + # for the manufacturing overview. + # + # Submitted is preferred if both exist. work_order_rows = frappe.get_all( "Work Order", filters={ @@ -334,15 +340,19 @@ def get_work_orders( "in", sales_order_items, ], - "docstatus": 1, + "docstatus": [ + "<", + 2, + ], }, fields=[ "name", "sales_order_item", "planned_end_date", + "docstatus", "creation", ], - order_by="creation desc", + order_by="docstatus desc, creation desc", ) result = {} @@ -352,8 +362,6 @@ def get_work_orders( work_order.sales_order_item ) - # The query is newest first. - # Keep the newest submitted WO. if sales_order_item not in result: result[ sales_order_item @@ -364,7 +372,6 @@ def get_work_orders( def get_planned_subcontracting_entry( row, - work_order, ): return { "source": @@ -491,11 +498,7 @@ def get_subcontracting_data( * len(sales_order_items) ) - # Include both: - # - # docstatus 0 = Draft - # docstatus 1 = Submitted - # + # Include both Draft and Submitted POs. # Cancelled documents are ignored. purchase_order_items = frappe.db.sql( f""" @@ -562,7 +565,6 @@ def get_subcontracting_data( if not purchase_order_items: return {} - # Group PO items by Sales Order Item. purchase_orders_by_so_item = {} for poi in purchase_order_items: @@ -592,8 +594,8 @@ def get_subcontracting_data( if poi.purchase_order_docstatus == 0 ] - # If a real submitted PO exists, - # don't also show its old planning draft. + # Once a submitted PO exists, do not + # also show its old draft planning PO. if submitted: selected_purchase_order_items.extend( submitted @@ -677,8 +679,7 @@ def get_subcontracting_data( ) for row in subcontracting_orders: - # Prefer the newest submitted SCO - # if more than one somehow exists. + # Prefer newest submitted SCO. if ( row.purchase_order_item not in sco_by_purchase_order_item @@ -755,7 +756,7 @@ def get_subcontracting_data( continue # ------------------------------------------------------------- - # Submitted PO + # Submitted Purchase Order # ------------------------------------------------------------- sco = ( @@ -764,7 +765,8 @@ def get_subcontracting_data( ) ) - # PO submitted, but SCO not yet created/submitted. + # PO submitted but SCO not yet + # created/submitted. if not sco: result[ sales_order_item @@ -878,7 +880,7 @@ def has_material_been_transferred( status, ): # Partial Material Transferred deliberately - # does NOT count as complete handoff. + # does not count as complete handoff. return status in { "Material Transferred", "Partially Received", @@ -891,8 +893,9 @@ def get_effective_sort_date( planned_end_date, subcontracting_rows, ): - # If subcontracting is planned or active, - # Planned End Date is the production deadline. + # While subcontracting still requires our + # material, Planned End Date is the + # operational deadline. if ( planned_end_date and subcontracting_rows @@ -910,8 +913,8 @@ def get_effective_sort_date( planned_end_date ) - # Once material has left us, customer - # delivery becomes relevant again. + # Once material has left us, return the + # card to its customer-delivery position. if delivery_date: return getdate( delivery_date diff --git a/manufacturing_utilities/manufacturing_overview/cache.py b/manufacturing_utilities/manufacturing_overview/cache.py index 8d0b4e2..c9fc4e8 100644 --- a/manufacturing_utilities/manufacturing_overview/cache.py +++ b/manufacturing_utilities/manufacturing_overview/cache.py @@ -1,15 +1,26 @@ import frappe -CACHE_KEY = "manufacturing_utilities:manufacturing_overview" -REALTIME_EVENT = "manufacturing_overview_updated" +CACHE_KEY = ( + "manufacturing_utilities:" + "manufacturing_overview" +) + +REALTIME_EVENT = ( + "manufacturing_overview_updated" +) def get_cached_overview(): - return frappe.cache.get_value(CACHE_KEY) + return frappe.cache.get_value( + CACHE_KEY + ) -def set_cached_overview(data, expires_in_sec=60): +def set_cached_overview( + data, + expires_in_sec=60, +): frappe.cache.set_value( CACHE_KEY, data, @@ -17,14 +28,26 @@ def set_cached_overview(data, expires_in_sec=60): ) -def invalidate_overview_cache(doc=None, method=None): - frappe.cache.delete_value(CACHE_KEY) +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, + "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/translations.py b/manufacturing_utilities/manufacturing_overview/translations.py new file mode 100644 index 0000000..48b70c4 --- /dev/null +++ b/manufacturing_utilities/manufacturing_overview/translations.py @@ -0,0 +1,34 @@ +from frappe import _ + + +# This file exists so Frappe's translation extractor can discover +# all user-facing strings used by the Manufacturing Overview +# Custom HTML Block. + +TRANSLATION_STRINGS = [ + _("Manufacturing"), + _("Subcontracting"), + + _("Behind schedule"), + _("Today"), + _("Upcoming"), + + _("Partially Delivered"), + _("In Warehouse"), + _("To Produce"), + _("No Work Order"), + + _("Draft"), + _("To Transfer"), + _("Material Transferred"), + _("Partial Material Transferred"), + _("Partially Received"), + _("Completed"), + _("Planned"), + + _("No Purchase Order"), + _("Planned subcontracting"), + + _("No manufacturing items found."), + _("Failed to load Manufacturing Overview."), +] \ No newline at end of file