From e44219b1cdb80d37b557ff74767f5f3e5aca5072 Mon Sep 17 00:00:00 2001 From: Robin Heinz Date: Wed, 26 May 2021 07:56:47 +0000 Subject: [FIX] point_of_sale: Load all existing Payment Method but displayed linked ones Before, when using the manage order, if a payment method was used and then removed from the pos.config, we couldn't load the old order anymore because of unknow reference. To fix this, we load all methods at the opening of the pos but when we display the payment methods we only show those in the pos.config. closes odoo/odoo#71263 Task-id: 2541708 Signed-off-by: pimodoo --- .../static/src/js/Screens/PaymentScreen/PaymentScreen.js | 1 + addons/point_of_sale/static/src/js/models.js | 4 +--- .../static/src/xml/Screens/PaymentScreen/PaymentScreen.xml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js index 5bba625c61b..65a735df033 100644 --- a/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js +++ b/addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js @@ -31,6 +31,7 @@ odoo.define('point_of_sale.PaymentScreen', function (require) { onChangeOrder(this._onPrevOrder, this._onNewOrder); useErrorHandlers(); this.payment_interface = null; + this.payment_methods_from_config = this.env.pos.payment_methods.filter(method => this.env.pos.config.payment_method_ids.includes(method.id)); } get currentOrder() { return this.env.pos.get_order(); diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index f2081eefd6d..62424ef80ef 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -504,9 +504,7 @@ exports.PosModel = Backbone.Model.extend({ },{ model: 'pos.payment.method', fields: ['name', 'is_cash_count', 'use_payment_terminal'], - domain: function(self, tmp) { - return [['id', 'in', tmp.payment_method_ids]]; - }, + domain: function(self){return ['|',['active', '=', false], ['active', '=', true]]; }, loaded: function(self, payment_methods) { self.payment_methods = payment_methods.sort(function(a,b){ // prefer cash payment_method to be first in the list diff --git a/addons/point_of_sale/static/src/xml/Screens/PaymentScreen/PaymentScreen.xml b/addons/point_of_sale/static/src/xml/Screens/PaymentScreen/PaymentScreen.xml index a06e09db484..d78128c933d 100644 --- a/addons/point_of_sale/static/src/xml/Screens/PaymentScreen/PaymentScreen.xml +++ b/addons/point_of_sale/static/src/xml/Screens/PaymentScreen/PaymentScreen.xml @@ -29,7 +29,7 @@
- -- cgit v1.2.3