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,18 +95,13 @@ odoo.define("pos_meal_voucher.screens", function (require) { ...@@ -100,18 +95,13 @@ odoo.define("pos_meal_voucher.screens", function (require) {
screens.PaymentScreenWidget.include({ screens.PaymentScreenWidget.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);
}, },
......
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