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
388ec710
Commit
388ec710
authored
Mar 24, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display cutlery symbol directly in template as svg
parent
5743b9cb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
63 deletions
+49
-63
fr.po
lacagette_addons/pos_meal_voucher/i18n/fr.po
+3
-3
models.js
lacagette_addons/pos_meal_voucher/static/src/js/models.js
+19
-28
screens.js
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
+13
-28
pos_meal_voucher.xml
...dons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml
+14
-4
No files found.
lacagette_addons/pos_meal_voucher/i18n/fr.po
View file @
388ec710
...
...
@@ -355,21 +355,21 @@ msgstr "Pour ajouter un chèque restaurant merci de fermer cette fenêtre et sca
#. module: pos_meal_voucher
#. openerp-web
#: code:addons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml:
96
#: code:addons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml:
101
#, python-format
msgid "Eligible subtotal for meal vouchers:"
msgstr "Sous-total éligible en tickets restaurant :"
#. module: pos_meal_voucher
#. openerp-web
#: code:addons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml:1
1
0
#: code:addons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml:1
2
0
#, python-format
msgid "Eligible subtotal for"
msgstr "Sous-total éligible en"
#. module: pos_meal_voucher
#. openerp-web
#: code:addons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml:1
1
2
#: code:addons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml:1
2
2
#, python-format
msgid "meal vouchers:"
msgstr "tickets restaurant :"
lacagette_addons/pos_meal_voucher/static/src/js/models.js
View file @
388ec710
...
...
@@ -43,42 +43,33 @@ odoo.define("pos_meal_voucher.models", function (require) {
}
}),
0
),
this
.
pos
.
currency
.
rounding
);
},
/* point_of_sale/statis/src/js/models.js */
export_for_printing
:
function
(){
var
orderlines
=
[];
var
self
=
this
;
var
paymentlines
=
[];
// Add fork&knife symbol on pos ticket for products with meal voucher allowed & when meal voucher is used
is_meal_voucher_used
:
function
()
{
var
meal_voucher_used
=
false
;
this
.
paymentlines
.
each
(
function
(
paymentline
){
var
line
=
paymentline
.
export_for_printing
();
paymentlines
.
push
(
line
);
this
.
paymentlines
.
each
(
function
(
paymentline
)
{
if
(
paymentline
.
is_meal_voucher
())
{
meal_voucher_used
=
true
;
return
false
;
}
});
var
meal_voucher_symbol
=
String
.
fromCharCode
(
0xD83C
,
0xDF74
);
return
meal_voucher_used
;
},
/* point_of_sale/statis/src/js/models.js */
export_for_printing
:
function
(){
var
orderlines
=
[];
var
self
=
this
;
this
.
orderlines
.
each
(
function
(
orderline
){
var
orderline_for_printing
=
orderline
.
export_for_printing
()
if
(
meal_voucher_used
===
true
&&
orderline
.
product
.
meal_voucher_ok
===
true
&&
orderline_for_printing
.
product_name
.
includes
(
meal_voucher_symbol
)
===
false
)
{
orderline_for_printing
.
product_name
=
meal_voucher_symbol
+
" "
+
orderline_for_printing
.
product_name
;
}
else
if
(
meal_voucher_used
===
false
&&
orderline_for_printing
.
product_name
.
includes
(
meal_voucher_symbol
)
===
true
)
{
orderline_for_printing
.
product_name
=
orderline_for_printing
.
product_name
.
replace
(
meal_voucher_symbol
+
" "
,
""
);
}
var
orderline_for_printing
=
orderline
.
export_for_printing
();
orderline_for_printing
.
product_meal_voucher_ok
=
orderline
.
product
.
meal_voucher_ok
;
orderlines
.
push
(
orderline_for_printing
);
});
var
paymentlines
=
[];
this
.
paymentlines
.
each
(
function
(
paymentline
){
paymentlines
.
push
(
paymentline
.
export_for_printing
());
});
var
client
=
this
.
get
(
'client'
);
var
cashier
=
this
.
pos
.
cashier
||
this
.
pos
.
user
;
var
company
=
this
.
pos
.
company
;
...
...
@@ -147,7 +138,7 @@ odoo.define("pos_meal_voucher.models", function (require) {
name
:
shop
.
name
,
},
currency
:
this
.
pos
.
currency
,
meal_voucher_used
:
meal_voucher_used
,
meal_voucher_used
:
this
.
is_meal_voucher_used
()
,
total_meal_voucher_eligible
:
this
.
get_total_meal_voucher_eligible
()
};
...
...
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
View file @
388ec710
...
...
@@ -403,40 +403,25 @@ odoo.define("pos_meal_voucher.screens", function (require) {
/* point_of_sale/statis/src/js/screens.js */
screens
.
ReceiptScreenWidget
.
include
({
render_receipt
:
function
()
{
var
order
=
this
.
pos
.
get_order
();
var
orderlines
=
order
.
get_orderlines
();
var
paymentlines
=
order
.
get_paymentlines
();
// Add fork&knife symbol on pos ticket for product with meal voucher allowed & when meal voucher is used
order
.
meal_voucher_used
=
false
;
for
(
var
i
=
0
;
i
<
paymentlines
.
length
;
i
++
)
{
if
(
paymentlines
[
i
].
is_meal_voucher
())
{
order
.
meal_voucher_used
=
true
;
break
;
}
var
env
=
{
widget
:
this
,
pos
:
this
.
pos
,
order
:
this
.
pos
.
get_order
(),
receipt
:
this
.
pos
.
get_order
().
export_for_printing
(),
paymentlines
:
this
.
pos
.
get_order
().
get_paymentlines
()
};
this
.
$
(
'.pos-receipt-container'
).
html
(
QWeb
.
render
(
'XmlReceipt'
,
env
));
/*var order = this.pos.get_order();
order.meal_voucher_used = order.is_meal_voucher_used();
var
meal_voucher_symbol
=
String
.
fromCharCode
(
0xD83C
,
0xDF74
);
for
(
var
i
=
0
;
i
<
orderlines
.
length
;
i
++
)
{
if
(
order
.
meal_voucher_used
===
true
&&
orderlines
[
i
].
product
.
meal_voucher_ok
===
true
&&
orderlines
[
i
].
product
.
display_name
.
includes
(
meal_voucher_symbol
)
===
false
)
{
orderlines
[
i
].
product
.
display_name
=
meal_voucher_symbol
+
" "
+
orderlines
[
i
].
product
.
display_name
;
}
else
if
(
order
.
meal_voucher_used
===
false
&&
orderlines
[
i
].
product
.
display_name
.
includes
(
meal_voucher_symbol
)
===
true
)
{
orderlines
[
i
].
product
.
display_name
=
orderlines
[
i
].
product
.
display_name
.
replace
(
meal_voucher_symbol
+
" "
,
""
);
}
}
this.$('.pos-receipt-container').html(QWeb.render('PosTicket',{
widget:this,
order: order,
receipt: order.export_for_printing(),
orderlines
:
order
lines
,
paymentlines
:
paymentlines
}));
orderlines: order
.get_orderlines()
,
paymentlines:
order.get_paymentlines()
}));
*/
}
});
});
lacagette_addons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml
View file @
388ec710
...
...
@@ -84,8 +84,13 @@
</t>
</t>
<t
t-extend=
"PosTicket"
>
<t
t-jquery=
"table.receipt-total"
t-operation=
"before"
>
<t
t-extend=
"PosTicket"
>
<!-- Ticket displayed on screen -->
<t
t-jquery=
"table.receipt-orderlines tr td:first"
t-operation=
"prepend"
>
<!-- Add cutlery on orderline if needed -->
<t
t-if=
"order.meal_voucher_used === true and orderline.get_product().meal_voucher_ok === true"
>
<i
class=
"fa fa-cutlery"
/>
</t>
</t>
<t
t-jquery=
"table.receipt-total"
t-operation=
"before"
>
<!-- meal voucher subtotal-->
<t
t-if=
"order.meal_voucher_used === true"
>
<table
class=
'receipt-eligible-meal-voucher'
>
<colgroup>
...
...
@@ -93,7 +98,7 @@
<col
width=
'25%'
/>
</colgroup>
<tr>
<td>
Eligible subtotal for meal vouchers:
</td>
<td>
<i
class=
"fa fa-cutlery"
/>
Eligible subtotal for meal vouchers:
</td>
<td
class=
"pos-right-align"
>
<t
t-esc=
"widget.format_currency(order.get_total_meal_voucher_eligible())"
/>
</td>
...
...
@@ -103,7 +108,12 @@
</t>
</t>
</t>
<t
t-extend=
"XmlReceipt"
>
<t
t-extend=
"XmlReceipt"
>
<!-- Ticket sent to the printer -->
<t
t-jquery=
"div.orderlines line:not([indent]) left"
t-operation=
"prepend"
>
<!-- hack to get product name line (lines with qty have 'indent' attr) -->
<t
t-if=
'receipt.meal_voucher_used === true and line.product_meal_voucher_ok === true'
>
<i
class=
"fa fa-cutlery"
/>
</t>
</t>
<t
t-jquery=
"div.orderlines"
t-operation=
"after"
>
<t
t-if=
"receipt.meal_voucher_used === true"
>
<line><right>
--------
</right></line>
...
...
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