Commit 37d90424 by Thibault Grandjean

change method to check if meal voucher is activated on pos

parent 0b42a4c6
...@@ -67,18 +67,13 @@ odoo.define("pos_meal_voucher.screens", function (require) { ...@@ -67,18 +67,13 @@ odoo.define("pos_meal_voucher.screens", function (require) {
screens.OrderWidget.include({ screens.OrderWidget.include({
//check if POS if configured to accept payment in meal voucher
meal_voucher_activated: function() { meal_voucher_activated: function() {
var payment_methods = this.pos.cashregisters.map( var is_meal_voucher_method = this.pos.cashregisters.map(function(cash_register) {
function(method) { if (cash_register.journal.meal_voucher_type === "paper" || cash_register.journal.meal_voucher_type === "dematerialized") {
return method.journal_id[1] return true
} }
); })
var is_meal_voucher_method = payment_methods.map(
function(method_name) {
var regex = new RegExp('Déj')
return regex.test(method_name)
}
);
return is_meal_voucher_method.includes(true); return is_meal_voucher_method.includes(true);
}, },
...@@ -100,20 +95,15 @@ odoo.define("pos_meal_voucher.screens", function (require) { ...@@ -100,20 +95,15 @@ odoo.define("pos_meal_voucher.screens", function (require) {
screens.PaymentScreenWidget.include({ screens.PaymentScreenWidget.include({
meal_voucher_activated: function() { //check if POS if configured to accept payment in meal voucher
var payment_methods = this.pos.cashregisters.map( meal_voucher_activated: function() {
function(method) { var is_meal_voucher_method = this.pos.cashregisters.map(function(cash_register) {
return method.journal_id[1] if (cash_register.journal.meal_voucher_type === "paper" || cash_register.journal.meal_voucher_type === "dematerialized") {
} return true
); }
var is_meal_voucher_method = payment_methods.map( })
function(method_name) { return is_meal_voucher_method.includes(true);
var regex = new RegExp('Déj') },
return regex.test(method_name)
}
);
return is_meal_voucher_method.includes(true);
},
// odoo/addons/point_of_sale/static/src/js/screens.js // odoo/addons/point_of_sale/static/src/js/screens.js
// We need to change the default behaviour of locking input with // We need to change the default behaviour of locking input with
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment