[IMP] open_workshop_pos: Fix Produktsuche und verbessere UI

- Fix: ProductScreen Patch korrigiert - Suchfeld erscheint wieder
  * Verwendung von patch() statt Klassen-Vererbung für korrekte Komponenten-Registrierung
  * Behebt OwlError 'Cannot find OwsPosSidebar'

- Add: Preisanzeige auf Produktkarten
  * Listenpreis wird unter Produktname angezeigt
  * Konsistente Ausrichtung am unteren Rand
  * Produkte mit/ohne Bild haben gleiche Preis-Position

- UX: Warenkorb-Mengenanzeige auf Produktkarten entfernt
  * Ruhigeres, übersichtlicheres Erscheinungsbild
  * Mengen nur noch in Bestellübersicht sichtbar
This commit is contained in:
Matthias Lotz 2026-01-06 11:25:24 +01:00
parent 0c4b58e0a6
commit b151894c39
3 changed files with 33 additions and 8 deletions

View File

@ -44,6 +44,7 @@ Autor: HobbyHimmel
'open_workshop_pos/static/src/xml/ows_pos_customer_sidebar.xml',
'open_workshop_pos/static/src/xml/ows_machine_access_list.xml',
'open_workshop_pos/static/src/xml/ows_product_screen_template_patch.xml',
'open_workshop_pos/static/src/xml/ows_product_card_patch.xml',
# CSS
'open_workshop_pos/static/src/css/pos.css',

View File

@ -1,15 +1,14 @@
// product_screen_template_patch.js
// @odoo-module
import { registry } from "@web/core/registry";
import { ProductScreen } from "@point_of_sale/app/screens/product_screen/product_screen";
import { patch } from "@web/core/utils/patch";
import { OwsPosSidebar } from "./ows_pos_sidebar";
class OwsProductScreen extends ProductScreen {
static components = Object.assign({}, ProductScreen.components, {
// Patch the ProductScreen components to add the OwsPosSidebar
patch(ProductScreen, {
components: {
...ProductScreen.components,
OwsPosSidebar,
});
}
registry.category("pos_screens").remove("ProductScreen");
registry.category("pos_screens").add("ProductScreen", OwsProductScreen);
},
});

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<!-- Erweitere ProductCard um den Preis anzuzeigen -->
<t t-name="point_of_sale.ProductCard" t-inherit="point_of_sale.ProductCard" t-inherit-mode="extension">
<!-- Ändere das Layout zu flex-column mit justify-content-end für Ausrichtung am unteren Rand -->
<xpath expr="//div[hasclass('product-content')]" position="attributes">
<attribute name="class">product-content d-flex flex-column px-2 justify-content-end rounded-bottom rounded-3 flex-shrink-1</attribute>
</xpath>
<!-- Entferne die Margins vom Produktnamen für kompakteres Layout -->
<xpath expr="//div[hasclass('product-name')]" position="attributes">
<attribute name="class">overflow-hidden lh-sm product-name mb-1</attribute>
</xpath>
<!-- Füge den Preis nach dem Produktnamen hinzu -->
<xpath expr="//div[hasclass('product-name')]" position="after">
<div t-if="props.product?.lst_price" class="product-price text-primary fw-bold fs-6 mb-2">
<t t-esc="env.utils.formatCurrency(props.product.lst_price)"/>
</div>
</xpath>
<!-- Entferne die Warenkorb-Mengenanzeige für ruhigere Optik -->
<xpath expr="//h1[hasclass('product-cart-qty')]" position="replace"/>
</t>
</templates>