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
5db467b0
Commit
5db467b0
authored
Feb 09, 2022
by
Etienne Freiss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display a popup if the meal voucher was already scan on this order
parent
4183965e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
1 deletions
+43
-1
fr.po
lacagette_addons/pos_meal_voucher/i18n/fr.po
+22
-0
models.js
lacagette_addons/pos_meal_voucher/static/src/js/models.js
+8
-0
screens.js
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
+13
-1
No files found.
lacagette_addons/pos_meal_voucher/i18n/fr.po
View file @
5db467b0
...
@@ -316,3 +316,24 @@ msgstr " ) est inférieur à la valeur du/des ticket(s)( "
...
@@ -316,3 +316,24 @@ msgstr " ) est inférieur à la valeur du/des ticket(s)( "
#, python-format
#, python-format
msgid "Warning, the input amount of meal voucher is above the maximum amount of "
msgid "Warning, the input amount of meal voucher is above the maximum amount of "
msgstr "Le montant saisi est supérieur au montant maximum/au maximum éligible de "
msgstr "Le montant saisi est supérieur au montant maximum/au maximum éligible de "
#. module: pos_meal_voucher
#. openerp-web
#: code:addons/pos_meal_voucher/static/src/js/screens.js:
#, python-format
msgid "Meal Voucher already used"
msgstr "Ticket restaurant déjà scanné"
#. module: pos_meal_voucher
#. openerp-web
#: code:addons/pos_meal_voucher/static/src/js/screens.js:
#, python-format
msgid "The paper meal voucher "
msgstr "Le ticket restaurant "
#. module: pos_meal_voucher
#. openerp-web
#: code:addons/pos_meal_voucher/static/src/js/screens.js:
#, python-format
msgid " was already used"
msgstr " a déjà été scanné"
\ No newline at end of file
lacagette_addons/pos_meal_voucher/static/src/js/models.js
View file @
5db467b0
...
@@ -17,6 +17,14 @@ odoo.define("pos_meal_voucher.models", function (require) {
...
@@ -17,6 +17,14 @@ odoo.define("pos_meal_voucher.models", function (require) {
var
OrderSuper
=
models
.
Order
.
prototype
;
var
OrderSuper
=
models
.
Order
.
prototype
;
var
Order
=
models
.
Order
.
extend
({
var
Order
=
models
.
Order
.
extend
({
paper_meal_vouche_number_already_used
:
function
(
meal_voucher_number
){
for
(
const
paiementLine
of
this
.
get_paymentlines
()){
if
(
paiementLine
.
statement_note
==
meal_voucher_number
)
return
true
}
return
false
;
},
get_total_meal_voucher_eligible
:
function
()
{
get_total_meal_voucher_eligible
:
function
()
{
return
round_pr
(
this
.
orderlines
.
reduce
((
function
(
sum
,
orderLine
)
{
return
round_pr
(
this
.
orderlines
.
reduce
((
function
(
sum
,
orderLine
)
{
if
(
orderLine
.
product
.
meal_voucher_ok
&&
orderLine
.
get_price_with_tax
()
>
0
){
if
(
orderLine
.
product
.
meal_voucher_ok
&&
orderLine
.
get_price_with_tax
()
>
0
){
...
...
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
View file @
5db467b0
...
@@ -13,6 +13,8 @@ odoo.define("pos_meal_voucher.screens", function (require) {
...
@@ -13,6 +13,8 @@ odoo.define("pos_meal_voucher.screens", function (require) {
screens
.
ScreenWidget
.
include
({
screens
.
ScreenWidget
.
include
({
barcode_meal_voucher_payment_action
:
function
(
code
)
{
barcode_meal_voucher_payment_action
:
function
(
code
)
{
var
oder
=
this
.
pos
.
get_order
();
if
(
!
oder
.
paper_meal_vouche_number_already_used
(
code
.
code
)){
// Display the payment screen, if it is not the current one.
// Display the payment screen, if it is not the current one.
if
(
this
.
pos
.
gui
.
current_screen
.
template
!==
"PaymentScreenWidget"
){
if
(
this
.
pos
.
gui
.
current_screen
.
template
!==
"PaymentScreenWidget"
){
this
.
gui
.
show_screen
(
"payment"
);
this
.
gui
.
show_screen
(
"payment"
);
...
@@ -40,6 +42,17 @@ odoo.define("pos_meal_voucher.screens", function (require) {
...
@@ -40,6 +42,17 @@ odoo.define("pos_meal_voucher.screens", function (require) {
paymentScreen
.
order_changes
();
paymentScreen
.
order_changes
();
paymentScreen
.
render_paymentlines
();
paymentScreen
.
render_paymentlines
();
paymentScreen
.
$
(
".paymentline.selected .edit"
).
text
(
paymentScreen
.
format_currency_no_symbol
(
amount
));
paymentScreen
.
$
(
".paymentline.selected .edit"
).
text
(
paymentScreen
.
format_currency_no_symbol
(
amount
));
}
else
{
this
.
gui
.
show_popup
(
"alert"
,
{
'title'
:
_t
(
"Meal Voucher Amount already used"
),
'body'
:
_t
(
"The paper meal voucher "
)
+
code
.
code
+
_t
(
" was already used"
),
});
}
},
},
// Setup the callback action for the "meal_voucher_payment" barcodes.
// Setup the callback action for the "meal_voucher_payment" barcodes.
...
@@ -97,7 +110,6 @@ odoo.define("pos_meal_voucher.screens", function (require) {
...
@@ -97,7 +110,6 @@ odoo.define("pos_meal_voucher.screens", function (require) {
var
paymentScreen
=
this
.
pos
.
gui
.
current_screen
;
var
paymentScreen
=
this
.
pos
.
gui
.
current_screen
;
var
order
=
this
.
pos
.
get_order
();
var
order
=
this
.
pos
.
get_order
();
if
(
order
.
selected_paymentline
.
is_dematerialized_meal_voucher
()){
if
(
order
.
selected_paymentline
.
is_dematerialized_meal_voucher
()){
var
total_eligible
=
order
.
get_total_meal_voucher_eligible
();
var
total_eligible
=
order
.
get_total_meal_voucher_eligible
();
var
total_received
=
order
.
get_total_meal_voucher_received
();
var
total_received
=
order
.
get_total_meal_voucher_received
();
...
...
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