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
a07a5ab5
Commit
a07a5ab5
authored
Feb 02, 2022
by
Etienne Freiss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
develop
parent
7cd0bdea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletions
+36
-1
models.js
lacagette_addons/pos_meal_voucher/static/src/js/models.js
+4
-0
screens.js
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
+32
-1
No files found.
lacagette_addons/pos_meal_voucher/static/src/js/models.js
View file @
a07a5ab5
...
...
@@ -71,6 +71,10 @@ odoo.define("pos_meal_voucher.models", function (require) {
this
.
cashregister
.
journal
.
meal_voucher_type
)
!==
-
1
);
},
is_dematerialized_meal_voucher
:
function
()
{
return
(
this
.
cashregister
.
journal
.
meal_voucher_type
==
"dematerialized"
)
;
},
});
...
...
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
View file @
a07a5ab5
...
...
@@ -89,10 +89,41 @@ odoo.define("pos_meal_voucher.screens", function (require) {
return
methods
;
},
click_paymentmethods
:
function
(
id
)
{
var
self
=
this
;
var
methods
=
this
.
_super
.
apply
(
this
,
arguments
);
var
paymentScreen
=
this
.
pos
.
gui
.
current_screen
;
var
order
=
this
.
pos
.
get_order
();
if
(
order
.
selected_paymentline
.
is_dematerialized_meal_voucher
()){
var
total_eligible
=
order
.
get_total_meal_voucher_eligible
();
var
total_received
=
order
.
get_total_meal_voucher_received
();
var
max_amount
=
this
.
pos
.
config
.
max_meal_voucher_amount
;
var
current_max
=
total_eligible
;
if
(
max_amount
)
{
current_max
=
Math
.
min
(
total_eligible
,
max_amount
);
}
// Check how much is still possible to pay with meal voucher
// The selected line is "by default" set to the rest to pay of the order
const
max_curent_amount
=
current_max
-
total_received
+
order
.
selected_paymentline
.
get_amount
();
order
.
selected_paymentline
.
set_amount
(
max_curent_amount
);
paymentScreen
.
order_changes
();
paymentScreen
.
render_paymentlines
();
paymentScreen
.
$
(
".paymentline.selected .edit"
).
text
(
paymentScreen
.
format_currency_no_symbol
(
max_curent_amount
));
}
},
render_paymentlines
:
function
()
{
var
self
=
this
;
this
.
_super
.
apply
(
this
,
arguments
);
var
order
=
this
.
pos
.
get_order
();
if
(
!
order
)
{
...
...
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