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
e81534a3
Commit
e81534a3
authored
Jun 17, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prevent closing pos if ongoing order
parent
ce8930fb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
5 deletions
+56
-5
__openerp__.py
lacagette_addons/lacagette_custom_pos/__openerp__.py
+2
-1
fr.po
lacagette_addons/lacagette_custom_pos/i18n/fr.po
+5
-0
pos_config.py
lacagette_addons/lacagette_custom_pos/models/pos_config.py
+6
-2
screens.js
...ette_addons/lacagette_custom_pos/static/src/js/screens.js
+42
-2
view_pos_config.xml
...tte_addons/lacagette_custom_pos/views/view_pos_config.xml
+1
-0
No files found.
lacagette_addons/lacagette_custom_pos/__openerp__.py
View file @
e81534a3
...
@@ -14,7 +14,8 @@
...
@@ -14,7 +14,8 @@
Personnalisation de la popup d'erreur "codebarre non reconnu" :
\n
Personnalisation de la popup d'erreur "codebarre non reconnu" :
\n
- Faire clignoter la popup d'erreur quand le codebarre n'est pas reconnu
- Faire clignoter la popup d'erreur quand le codebarre n'est pas reconnu
- Jouer le son d'erreur plusieurs fois
- Jouer le son d'erreur plusieurs fois
- [FONCTION COMMENTEE] Afficher dans la popup le dernier produit scanné
- [FONCTION DÉSACTIVÉE] Afficher dans la popup le dernier produit scanné
\n
Bloquer ou non la fermeture d'une session de caisse s'il reste une commande en cours (configurable pour chaque caisse)
"""
,
"""
,
'author'
:
"fracolo"
,
'author'
:
"fracolo"
,
...
...
lacagette_addons/lacagette_custom_pos/i18n/fr.po
View file @
e81534a3
...
@@ -21,6 +21,11 @@ msgid "Reload on prices change"
...
@@ -21,6 +21,11 @@ msgid "Reload on prices change"
msgstr "Rechargement si des prix changent"
msgstr "Rechargement si des prix changent"
#. module: lacagette_custom_pos
#. module: lacagette_custom_pos
#: model:ir.model.fields,field_description:lacagette_custom_pos.field_pos_config__can_close_pos_with_ongoing_order
msgid "Allow or not closing a pos session in case of ongoing order"
msgstr "Autoriser ou non la fermeture d'une session de caisse s'il reste une commande en cours"
#. module: lacagette_custom_pos
#. openerp-web
#. openerp-web
#: code:lacagette_addons/lacagette_custom_pos/static/src/js/screens.js:73
#: code:lacagette_addons/lacagette_custom_pos/static/src/js/screens.js:73
#, python-format
#, python-format
...
...
lacagette_addons/lacagette_custom_pos/models/pos_config.py
View file @
e81534a3
...
@@ -6,4 +6,8 @@ class PosConfig(models.Model):
...
@@ -6,4 +6,8 @@ class PosConfig(models.Model):
reload_on_prices_change
=
fields
.
Boolean
(
reload_on_prices_change
=
fields
.
Boolean
(
string
=
"Reload on prices change"
,
string
=
"Reload on prices change"
,
default
=
False
)
default
=
False
)
\ No newline at end of file
can_close_pos_with_ongoing_order
=
fields
.
Boolean
(
string
=
"Allow closing a pos session in case of ongoing order"
,
default
=
True
)
\ No newline at end of file
lacagette_addons/lacagette_custom_pos/static/src/js/screens.js
View file @
e81534a3
...
@@ -9,8 +9,9 @@ odoo.define("lacagette_custom_pos.screens", function (require) {
...
@@ -9,8 +9,9 @@ odoo.define("lacagette_custom_pos.screens", function (require) {
var
_t
=
core
.
_t
;
var
_t
=
core
.
_t
;
const
interval
=
60
*
60
*
1000
;
// used for last_price_change call
const
interval
=
60
*
60
*
1000
;
// used for last_price_change call
var
reload_on_prices_change
=
false
;
var
reload_on_prices_change
=
false
;
models
.
load_fields
(
"pos.config"
,
[
'reload_on_prices_change'
]);
models
.
load_fields
(
"pos.config"
,
[
'reload_on_prices_change'
,
'can_cclose_pos_with_ongoing_order'
]);
var
close_button_action_setup
=
false
;
const
update_last_price_change_data
=
async
function
()
{
const
update_last_price_change_data
=
async
function
()
{
/*
/*
Ask odoo server data about last prices change
Ask odoo server data about last prices change
...
@@ -130,4 +131,43 @@ odoo.define("lacagette_custom_pos.screens", function (require) {
...
@@ -130,4 +131,43 @@ odoo.define("lacagette_custom_pos.screens", function (require) {
}
}
});
});
screens
.
ScreenWidget
.
include
({
init
:
function
(
parent
,
options
){
this
.
_super
(
parent
,
options
);
/*
* If activated in this pos session, prevent closing the session if there is an ongoing order.
* This is a hacky DOM manipulation: the user can technically close the session if he closes the popup and press 'Close' again in less than 2s.
* But this is very unlikely.
*
* ScreenWidget is a base widget extended by many others, we do this here to be sure this code is called...
*/
if
(
close_button_action_setup
===
false
)
{
// ... but we need to make sure it is called only once
close_button_action_setup
=
true
;
if
(
this
.
pos
.
config
.
can_close_pos_with_ongoing_order
===
false
)
{
let
header_nodes
=
document
.
querySelectorAll
(
".pos-topheader .pos-rightheader div"
);
let
close_button_div
=
header_nodes
[
header_nodes
.
length
-
1
];
let
self
=
this
;
close_button_div
.
addEventListener
(
"click"
,
function
(
e
)
{
let
order
=
self
.
pos
.
get_order
();
if
(
!
order
.
is_empty
())
{
if
(
close_button_div
.
classList
.
contains
(
"confirm"
))
{
close_button_div
.
classList
.
remove
(
"confirm"
);
close_button_div
.
textContent
=
_t
(
'Close'
);
}
self
.
gui
.
show_popup
(
"alert"
,
{
'title'
:
_t
(
"Impossible de fermer la caisse"
),
'body'
:
_t
(
"Des commandes sont encore en cours."
)
});
}
});
}
}
},
});
});
});
lacagette_addons/lacagette_custom_pos/views/view_pos_config.xml
View file @
e81534a3
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
<field
name=
"arch"
type=
"xml"
>
<field
name=
"arch"
type=
"xml"
>
<field
name=
"cash_control"
position=
"after"
>
<field
name=
"cash_control"
position=
"after"
>
<field
name=
"reload_on_prices_change"
/>
<field
name=
"reload_on_prices_change"
/>
<field
name=
"can_close_pos_with_ongoing_order"
/>
</field>
</field>
</field>
</field>
</record>
</record>
...
...
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