diff --git a/__manifest__.py b/__manifest__.py index d13a685..d6622b1 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -18,7 +18,7 @@ 'installable': True, 'assets': { 'web.assets_backend': [ - 'open_workshop/static/src/css/category_color.css', + 'static/src/css/category_color.css', ], 'point_of_sale._assets_pos': [ diff --git a/static/src/js/ows_machine_access_list.js b/static/src/js/ows_machine_access_list.js index 7e63850..40eb6ee 100644 --- a/static/src/js/ows_machine_access_list.js +++ b/static/src/js/ows_machine_access_list.js @@ -3,7 +3,7 @@ import { Component, useState } from "@odoo/owl"; import { useBus } from "@web/core/utils/hooks"; import { usePos } from "@point_of_sale/app/store/pos_hook"; -import { jsonrpc } from "@web/core/network/rpc_service"; +import { rpc } from "@web/core/network/rpc"; export class OwsMachineAccessList extends Component { static template = 'open_workshop.OwsMachineAccessList'; @@ -43,8 +43,10 @@ export class OwsMachineAccessList extends Component { } try { - const data = await jsonrpc("/open_workshop/partner_access", { - partner_id: partner.id, + const data = await rpc("/open_workshop/partner_access", { + params: { + partner_id: partner.id, + }, }); this.state.grouped_accesses = data.access_by_area || []; @@ -60,5 +62,6 @@ export class OwsMachineAccessList extends Component { this.state.rfid_card = ''; this.state.birthday = ''; } + } } diff --git a/static/src/js/ows_pos_customer_sidebar.js b/static/src/js/ows_pos_customer_sidebar.js index c7dd117..2b11d4d 100644 --- a/static/src/js/ows_pos_customer_sidebar.js +++ b/static/src/js/ows_pos_customer_sidebar.js @@ -4,7 +4,7 @@ import { Component } from "@odoo/owl"; import { useService } from "@web/core/utils/hooks"; import { usePos } from "@point_of_sale/app/store/pos_hook"; import { _t } from "@web/core/l10n/translation"; -import { ConfirmPopup } from "@point_of_sale/app/utils/confirm_popup/confirm_popup"; +import { ask } from "@web/core/confirmation_dialog/confirmation_dialog"; import { deserializeDateTime, formatDateTime, parseDateTime } from "@web/core/l10n/dates"; export class OwsPosCustomerSidebar extends Component { @@ -12,8 +12,7 @@ export class OwsPosCustomerSidebar extends Component { setup() { this.pos = usePos(); - this.popup = useService("popup"); - + this.dialog = useService("dialog"); } addOrder() { @@ -28,11 +27,12 @@ export class OwsPosCustomerSidebar extends Component { if (!order) return; // 🛑 Sicherheitsabfrage: Order enthält bereits Positionen - // Hinweis: Verhalten angelehnt an ticket_screen.js in Odoo 17.0 if (order.get_orderlines().length > 0) { - const { confirmed } = await this.popup.add(ConfirmPopup, { + const confirmed = await ask(this.dialog, { title: _t("Order enthält Positionen"), body: _t("Möchtest du diese Order wirklich löschen?"), + confirmText: _t("Löschen"), + cancelText: _t("Abbrechen"), }); if (!confirmed) return; } @@ -45,10 +45,9 @@ export class OwsPosCustomerSidebar extends Component { // ✅ Wenn noch andere Orders existieren, eine davon aktivieren if (remainingOrders.length > 0) { - this.pos.set_order(remainingOrders[remainingOrders.length - 1]); // z. B. letzte Order aktivieren + this.pos.set_order(remainingOrders[remainingOrders.length - 1]); } - // Hinweis: Weitere Funktionen wie Sync mit Server (siehe ticket_screen.js) können hier ergänzt werden. this.env.bus.trigger('partner-changed'); // ✅ korrektes Event feuern } @@ -69,13 +68,12 @@ export class OwsPosCustomerSidebar extends Component { return `${dd}.${mm}. ${hh}:${mi}`; } - getPartner(order) { return order.get_partner()?.name || "Kein Kunde"; } selectOrder(order) { this.pos.set_order(order); - this.env.bus.trigger('partner-changed'); // ✅ korrektes Event feuern + this.env.bus.trigger('partner-changed'); } } diff --git a/static/src/js/product_screen_template_patch.js b/static/src/js/product_screen_template_patch.js index d478e56..e3a979a 100644 --- a/static/src/js/product_screen_template_patch.js +++ b/static/src/js/product_screen_template_patch.js @@ -5,6 +5,8 @@ import { registry } from "@web/core/registry"; import { OwsPosCustomerSidebar } from "@open_workshop/js/ows_pos_customer_sidebar"; import { OwsMachineAccessList } from "@open_workshop/js/ows_machine_access_list"; +console.log("🔍 product_screen_template_patch.js wurde geladen"); + export class OwsProductScreen extends ProductScreen { static template = "open_workshop.ProductScreen"; static components = { @@ -12,6 +14,11 @@ export class OwsProductScreen extends ProductScreen { OwsPosCustomerSidebar, OwsMachineAccessList, }; + + setup() { + super.setup(); // wichtig! + console.log("📦 OwsProductScreen aktiv, Template:", this.constructor.template); + } } registry.category("pos_screens").remove("ProductScreen"); diff --git a/static/src/xml/ows_product_screen.xml b/static/src/xml/ows_product_screen.xml index 2893a3f..35fb953 100644 --- a/static/src/xml/ows_product_screen.xml +++ b/static/src/xml/ows_product_screen.xml @@ -1,46 +1,13 @@ - -
+ + +
+
-
- - - - - -
-
- - - -
-
- - -
-
-
- -
- - -
- -
-
-
-