diff options
| author | Joseph Caburnay <jcb@odoo.com> | 2021-01-26 08:11:04 +0000 |
|---|---|---|
| committer | Joseph Caburnay <jcb@odoo.com> | 2021-01-26 13:42:34 +0000 |
| commit | 9d8c808e9910886968b3a1dc9d17a88ceca2389a (patch) | |
| tree | c9ee67d5d5aac640b67fa744962a2315796b840c /addons/point_of_sale/static/src/js | |
| parent | ccadcba6f0828aff43e94eb59ac97238eef7a4b3 (diff) | |
[FIX] point_of_sale: translation issue in the ticket screen
The terms in the search bar of the ticket screen are not translated.
This commit fixes this issue by passing the translated form of the
terms to the search bar component.
closes odoo/odoo#65038
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'addons/point_of_sale/static/src/js')
| -rw-r--r-- | addons/point_of_sale/static/src/js/Misc/SearchBar.js | 2 | ||||
| -rw-r--r-- | addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js | 38 |
2 files changed, 30 insertions, 10 deletions
diff --git a/addons/point_of_sale/static/src/js/Misc/SearchBar.js b/addons/point_of_sale/static/src/js/Misc/SearchBar.js index d9bcfe879b1..e9f56feaf81 100644 --- a/addons/point_of_sale/static/src/js/Misc/SearchBar.js +++ b/addons/point_of_sale/static/src/js/Misc/SearchBar.js @@ -37,7 +37,7 @@ odoo.define('point_of_sale.SearchBar', function (require) { selectedFieldId: this.config.searchFields.length ? 0 : null, showSearchFields: false, showFilterOptions: false, - selectedFilter: this.config.filter.options[0] || 'Select', + selectedFilter: this.config.filter.options[0] || this.env._t('Select'), }); useExternalListener(window, 'click', this._hideOptions); } 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 38d4cd6efb4..dd7adce4e07 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 @@ -45,8 +45,9 @@ odoo.define('point_of_sale.TicketScreen', function (require) { return this.env.pos.get_order_list(); } get filteredOrderList() { + const { AllTickets } = this.getOrderStates(); const filterCheck = (order) => { - if (this.filter && this.filter !== 'All Tickets') { + if (this.filter && this.filter !== AllTickets) { const screen = order.get_screen_data(); return this.filter === this.constants.screenToStatusMap[screen.name]; } @@ -131,7 +132,8 @@ odoo.define('point_of_sale.TicketScreen', function (require) { }; } get filterOptions() { - return ['All Tickets', 'Ongoing', 'Payment', 'Receipt']; + const { AllTickets, Ongoing, Payment, Receipt } = this.getOrderStates(); + return [AllTickets, Ongoing, Payment, Receipt]; } /** * An object with keys containing the search field names which map to functions. @@ -158,14 +160,15 @@ odoo.define('point_of_sale.TicketScreen', function (require) { * @returns Record<string, (models.Order) => string> */ get _searchFields() { + const { ReceiptNumber, Date, Customer, CardholderName } = this.getSearchFieldNames(); var fields = { - 'Receipt Number': (order) => order.name, - Date: (order) => moment(order.creation_date).format('YYYY-MM-DD hh:mm A'), - Customer: (order) => order.get_client_name(), + [ReceiptNumber]: (order) => order.name, + [Date]: (order) => moment(order.creation_date).format('YYYY-MM-DD hh:mm A'), + [Customer]: (order) => order.get_client_name(), }; if (this.showCardholderName()) { - fields['Cardholder Name'] = (order) => order.get_cardholder_name(); + fields[CardholderName] = (order) => order.get_cardholder_name(); } return fields; @@ -174,10 +177,11 @@ odoo.define('point_of_sale.TicketScreen', function (require) { * Maps the order screen params to order status. */ get _screenToStatusMap() { + const { Ongoing, Payment, Receipt } = this.getOrderStates(); return { - ProductScreen: 'Ongoing', - PaymentScreen: 'Payment', - ReceiptScreen: 'Receipt', + ProductScreen: Ongoing, + PaymentScreen: Payment, + ReceiptScreen: Receipt, }; } _initializeSearchFieldConstants() { @@ -187,6 +191,22 @@ odoo.define('point_of_sale.TicketScreen', function (require) { screenToStatusMap: this._screenToStatusMap, }); } + getOrderStates() { + return { + AllTickets: this.env._t('All Tickets'), + Ongoing: this.env._t('Ongoing'), + Payment: this.env._t('Payment'), + Receipt: this.env._t('Receipt'), + }; + } + getSearchFieldNames() { + return { + ReceiptNumber: this.env._t('Receipt Number'), + Date: this.env._t('Date'), + Customer: this.env._t('Customer'), + CardholderName: this.env._t('Cardholder Name'), + }; + } } TicketScreen.template = 'TicketScreen'; |
