From a774b5ec7f7e90cee303bb230ea3295b7e63b433 Mon Sep 17 00:00:00 2001 From: Mountain Tran Date: Wed, 26 Apr 2023 06:47:28 +0000 Subject: [PATCH] [FIX] point_of_sale: correctly translate some UI elements Before some translations didn't work in the point_of_sale because in owl you can't use t-set to manage translations. In cashMovePopup, _t was used at a time when loading translations is not yet guaranteed. Now we have changed _t to _lt to ensure that the translation is done correctly. For the t-set, we have added the translations in static properties of the concerned components. closes odoo/odoo#120403 X-original-commit: b2b9f760844304858aa64c51e7bda87190b11386 Signed-off-by: Joseph Caburnay (jcb) --- .../static/src/js/Screens/ProductScreen/ProductScreen.js | 2 ++ .../static/src/js/Screens/TicketScreen/TicketScreen.js | 3 +++ .../static/src/xml/Screens/ProductScreen/ProductScreen.xml | 3 +-- .../static/src/xml/Screens/TicketScreen/TicketScreen.xml | 7 ++----- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js index 7e71e1e5e5e..a8cb02ad496 100644 --- a/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/ProductScreen/ProductScreen.js @@ -5,6 +5,7 @@ import { registry } from "@web/core/registry"; import { useService } from "@web/core/utils/hooks"; import { useBarcodeReader } from "@point_of_sale/app/barcode_reader_hook"; import { parseFloat } from "@web/views/fields/parsers"; +import { _lt } from "@web/core/l10n/translation"; import { NumberPopup } from "@point_of_sale/js/Popups/NumberPopup"; import { ErrorPopup } from "@point_of_sale/js/Popups/ErrorPopup"; @@ -31,6 +32,7 @@ export class ProductScreen extends ControlButtonsMixin(Component) { OrderWidget, ProductsWidget, }; + static numpadActionName = _lt("Payment"); setup() { super.setup(); diff --git a/addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js b/addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js index 189750c07c1..88c4fe290dd 100644 --- a/addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js @@ -6,6 +6,7 @@ import { registry } from "@web/core/registry"; import { useService } from "@web/core/utils/hooks"; import { deserializeDateTime } from "@web/core/l10n/dates"; import { parseFloat } from "@web/views/fields/parsers"; +import { _lt } from "@web/core/l10n/translation"; import { ErrorPopup } from "@point_of_sale/js/Popups/ErrorPopup"; import { ConfirmPopup } from "@point_of_sale/js/Popups/ConfirmPopup"; @@ -41,6 +42,8 @@ export class TicketScreen extends IndependentToOrderScreen { reuseSavedUIState: false, ui: {}, }; + static numpadActionName = _lt("Refund"); + static searchPlaceholder = _lt("Search Orders..."); setup() { super.setup(); diff --git a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/ProductScreen.xml b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/ProductScreen.xml index 32bb4a2c514..de29310bb6b 100644 --- a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/ProductScreen.xml +++ b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/ProductScreen.xml @@ -18,10 +18,9 @@
- Payment - Search Orders...
@@ -131,11 +130,9 @@
- - Refund