From 0042439be91b3fb32bfffd375807635c8c9c535b Mon Sep 17 00:00:00 2001 From: Robin Heinz Date: Wed, 26 May 2021 07:56:47 +0000 Subject: [PATCH] [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#71292 Task-id: 2541708 X-original-commit: e44219b1cdb80d37b557ff74767f5f3e5aca5072 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 b41ea6cda14..5aa8e2f9d14 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 0bd37871938..0992056dd19 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -505,9 +505,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 d3f818d249b..f6bb0bcfd19 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 @@
-