Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
odoo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
odoo
Commits
0b42a4c6
Commit
0b42a4c6
authored
Feb 22, 2022
by
Thibault Grandjean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hide meal voucher if it's not activated
parent
59273361
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
screens.js
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
+41
-0
No files found.
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
View file @
0b42a4c6
...
...
@@ -67,9 +67,29 @@ odoo.define("pos_meal_voucher.screens", function (require) {
screens
.
OrderWidget
.
include
({
meal_voucher_activated
:
function
()
{
var
payment_methods
=
this
.
pos
.
cashregisters
.
map
(
function
(
method
)
{
return
method
.
journal_id
[
1
]
}
);
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
);
},
update_summary
:
function
()
{
this
.
_super
.
apply
(
this
,
arguments
);
var
order
=
this
.
pos
.
get_order
();
if
(
!
this
.
meal_voucher_activated
())
{
this
.
el
.
querySelector
(
".summary .meal-voucher"
).
style
.
display
=
'none'
;
return
;
}
if
(
!
order
.
get_orderlines
().
length
)
{
return
;
}
...
...
@@ -80,6 +100,20 @@ odoo.define("pos_meal_voucher.screens", function (require) {
screens
.
PaymentScreenWidget
.
include
({
meal_voucher_activated
:
function
()
{
var
payment_methods
=
this
.
pos
.
cashregisters
.
map
(
function
(
method
)
{
return
method
.
journal_id
[
1
]
}
);
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
);
},
// odoo/addons/point_of_sale/static/src/js/screens.js
// We need to change the default behaviour of locking input with
...
...
@@ -296,6 +330,9 @@ odoo.define("pos_meal_voucher.screens", function (require) {
if
(
!
order
)
{
return
;
}
var
meal_voucher_available
=
this
.
meal_voucher_activated
();
// Update meal voucher summary
var
total_eligible
=
order
.
get_total_meal_voucher_eligible
();
this
.
el
.
querySelector
(
"#meal-voucher-eligible-amount"
).
textContent
=
this
.
format_currency
(
total_eligible
);
...
...
@@ -319,6 +356,10 @@ odoo.define("pos_meal_voucher.screens", function (require) {
this
.
$
(
"#meal-voucher-max-warning"
).
addClass
(
"oe_hidden"
);
}
if
(
!
this
.
meal_voucher_activated
())
{
this
.
$
(
".meal-voucher-summary"
).
addClass
(
"oe_hidden"
);
}
},
order_is_valid
:
function
(
force_validation
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment