summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRobin Heinz <rhe@odoo.com>2021-05-26 07:56:47 +0000
committerRobin Heinz <rhe@odoo.com>2021-05-26 13:06:44 +0000
commite44219b1cdb80d37b557ff74767f5f3e5aca5072 (patch)
treec46ac4863504c4b3f6e2a527de821eeb225049ac /addons
parentaff3a2e06801dfb7a58df5180fb4ab5487b27f02 (diff)
[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 <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/point_of_sale/static/src/js/Screens/PaymentScreen/PaymentScreen.js1
-rw-r--r--addons/point_of_sale/static/src/js/models.js4
-rw-r--r--addons/point_of_sale/static/src/xml/Screens/PaymentScreen/PaymentScreen.xml2
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 @@
<div class="paymentmethods-container">
<PaymentScreenPaymentLines paymentLines="paymentLines" />
<div class="paymentmethods">
- <t t-foreach="env.pos.payment_methods" t-as="paymentMethod"
+ <t t-foreach="payment_methods_from_config" t-as="paymentMethod"
t-key="paymentMethod.id">
<PaymentMethodButton paymentMethod="paymentMethod" />
</t>