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
25155939
Commit
25155939
authored
May 16, 2023
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add issuers dropdown in meal voucher issuer popup
parent
d5a1f82e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
5 deletions
+75
-5
pos_meal_voucher.css
...dons/pos_meal_voucher/static/src/css/pos_meal_voucher.css
+4
-0
models.js
lacagette_addons/pos_meal_voucher/static/src/js/models.js
+41
-0
screens.js
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
+18
-5
pos_meal_voucher.xml
...dons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml
+12
-0
No files found.
lacagette_addons/pos_meal_voucher/static/src/css/pos_meal_voucher.css
View file @
25155939
...
@@ -63,3 +63,6 @@
...
@@ -63,3 +63,6 @@
padding
:
8px
12px
;
padding
:
8px
12px
;
}
}
.popup-textinput
select
{
margin
:
10px
16px
!important
;
}
\ No newline at end of file
lacagette_addons/pos_meal_voucher/static/src/js/models.js
View file @
25155939
...
@@ -215,4 +215,45 @@ odoo.define("pos_meal_voucher.models", function (require) {
...
@@ -215,4 +215,45 @@ odoo.define("pos_meal_voucher.models", function (require) {
models
.
Paymentline
=
Paymentline
;
models
.
Paymentline
=
Paymentline
;
var
gui
=
require
(
'point_of_sale.gui'
);
var
PopupWidget
=
require
(
'point_of_sale.popups'
);
var
SelectOrTextInputPopupWidget
=
PopupWidget
.
extend
({
template
:
'TextInputPopupWidget'
,
show
:
function
(
options
){
options
=
options
||
{};
this
.
_super
(
options
);
this
.
renderElement
();
// On input change of value, reset select, and vice versa
this
.
$
(
"input"
).
on
(
"input"
,
(
e
)
=>
{
if
(
e
.
target
.
value
!==
''
)
{
this
.
$
(
"select"
).
val
(
''
).
change
();
}
})
this
.
$
(
"select"
).
on
(
"change"
,
(
e
)
=>
{
if
(
e
.
target
.
value
!==
''
)
{
this
.
$
(
"input"
).
val
(
''
);
}
})
},
click_confirm
:
function
(){
var
value
=
this
.
$
(
'select'
).
find
(
":selected"
).
val
()
?
this
.
$
(
'select'
).
find
(
":selected"
).
val
()
:
this
.
$
(
'input,textarea'
).
val
();
// At least one field is mandatory
if
(
value
===
''
)
{
return
;
}
this
.
gui
.
close_popup
();
if
(
this
.
options
.
confirm
){
this
.
options
.
confirm
.
call
(
this
,
value
);
}
},
});
gui
.
define_popup
({
name
:
'select-or-textinput'
,
widget
:
SelectOrTextInputPopupWidget
});
});
});
lacagette_addons/pos_meal_voucher/static/src/js/screens.js
View file @
25155939
...
@@ -195,6 +195,7 @@ odoo.define("pos_meal_voucher.screens", function (require) {
...
@@ -195,6 +195,7 @@ odoo.define("pos_meal_voucher.screens", function (require) {
};
};
this
.
meal_voucher_issuers
=
[];
// get meal voucher issuers from config
// get meal voucher issuers from config
config_parameter
.
call
(
'get_param'
,
[
'pos_meal_voucher.meal_voucher_issuers'
])
config_parameter
.
call
(
'get_param'
,
[
'pos_meal_voucher.meal_voucher_issuers'
])
.
then
(
function
(
value
){
.
then
(
function
(
value
){
...
@@ -306,8 +307,6 @@ odoo.define("pos_meal_voucher.screens", function (require) {
...
@@ -306,8 +307,6 @@ odoo.define("pos_meal_voucher.screens", function (require) {
// if user choose card meal voucher
// if user choose card meal voucher
if
(
order
.
selected_paymentline
.
is_meal_voucher
()
&&
order
.
selected_paymentline
.
is_dematerialized_meal_voucher
()){
if
(
order
.
selected_paymentline
.
is_meal_voucher
()
&&
order
.
selected_paymentline
.
is_dematerialized_meal_voucher
()){
// console.log(this.meal_voucher_issuers);
// update selected (last) payment line & order with meal voucher data
// update selected (last) payment line & order with meal voucher data
function
update_order_meal_voucher_data
(
issuer
=
''
)
{
function
update_order_meal_voucher_data
(
issuer
=
''
)
{
var
total_eligible
=
order
.
get_total_meal_voucher_eligible
();
var
total_eligible
=
order
.
get_total_meal_voucher_eligible
();
...
@@ -332,9 +331,23 @@ odoo.define("pos_meal_voucher.screens", function (require) {
...
@@ -332,9 +331,23 @@ odoo.define("pos_meal_voucher.screens", function (require) {
// If required by the config, ask for the meal voucher issuer
// If required by the config, ask for the meal voucher issuer
if
(
this
.
pos
.
config
.
meal_voucher_ask_for_issuer
)
{
if
(
this
.
pos
.
config
.
meal_voucher_ask_for_issuer
)
{
this
.
gui
.
show_popup
(
"textinput"
,
{
let
select_data
=
[{
'title'
:
_t
(
"Emetteur du titre restaurant"
),
'val'
:
""
,
'body'
:
_t
(
"Veuillez renseigner ci-dessous le nom de l'entité émettrice du titre restaurant."
),
'text'
:
"- Choississez un émetteur"
}];
for
(
let
issuer
of
this
.
meal_voucher_issuers
)
{
select_data
.
push
({
"val"
:
issuer
,
"text"
:
issuer
});
}
this
.
gui
.
show_popup
(
"select-or-textinput"
,
{
'title'
:
_t
(
"Émetteur du titre restaurant"
),
'body'
:
_t
(
"Si l'émetteur n'est pas dans la liste ci-dessus, veuillez le noter dans le champs ci-dessous : "
),
'selectText'
:
_t
(
"Veuillez sélectionner l'émetteur de CB déj dans la liste ci-dessous : "
),
'selectData'
:
select_data
,
confirm
:
function
(
value
)
{
confirm
:
function
(
value
)
{
let
issuer
=
value
;
let
issuer
=
value
;
update_order_meal_voucher_data
(
issuer
)
update_order_meal_voucher_data
(
issuer
)
...
...
lacagette_addons/pos_meal_voucher/static/src/xml/pos_meal_voucher.xml
View file @
25155939
...
@@ -78,6 +78,18 @@
...
@@ -78,6 +78,18 @@
</t>
</t>
<t
t-extend=
"TextInputPopupWidget"
>
<t
t-extend=
"TextInputPopupWidget"
>
<t
t-jquery=
"p.title"
t-operation=
"after"
>
<t
t-jquery=
"p.title"
t-operation=
"after"
>
<t
t-if=
"widget.options.selectText"
>
<p
class=
"body"
><t
t-esc=
"widget.options.selectText"
/></p>
</t>
<t
t-if=
"widget.options.selectData"
>
<select
class=
"select body"
>
<t
t-as=
"element"
t-foreach=
"widget.options.selectData"
>
<option
t-att-value=
"element.val"
>
<t
t-esc=
"element.text"
/>
</option>
</t>
</select>
</t>
<p
class=
"body"
><t
t-esc=
" widget.options.body || '' "
/></p>
<p
class=
"body"
><t
t-esc=
" widget.options.body || '' "
/></p>
</t>
</t>
</t>
</t>
...
...
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