diff --git a/pos_check_session_state/__manifest__.py b/pos_check_session_state/__manifest__.py
index b187f6c4..2a8f4c2c 100644
--- a/pos_check_session_state/__manifest__.py
+++ b/pos_check_session_state/__manifest__.py
@@ -7,8 +7,8 @@
'summary': 'Check if the session state is still opened',
'version': '12.0.1.0.0',
'category': 'Point Of Sale',
- 'author': "GRAP",
- 'website': 'http://www.grap.coop',
+ 'author': 'GRAP, Odoo Community Association (OCA)',
+ 'website': 'https://github.com/OCA/pos',
'license': 'AGPL-3',
'depends': [
'point_of_sale',
diff --git a/pos_check_session_state/i18n/fr.po b/pos_check_session_state/i18n/fr.po
index 42581c2b..c97c4cbc 100644
--- a/pos_check_session_state/i18n/fr.po
+++ b/pos_check_session_state/i18n/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-07-03 12:10+0000\n"
-"PO-Revision-Date: 2019-07-03 12:10+0000\n"
+"POT-Creation-Date: 2020-03-09 20:22+0000\n"
+"PO-Revision-Date: 2020-03-09 20:22+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -15,11 +15,6 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
-#. module: pos_check_session_state
-#: model_terms:ir.ui.view,arch_db:pos_check_session_state.view_pos_config_form
-msgid "Check Session State"
-msgstr "Vérifier l'état de la session"
-
#. module: pos_check_session_state
#: model:ir.model.fields,field_description:pos_check_session_state.field_pos_config__check_session_state_frequency
msgid "Frequency of Checking the State of the Session"
@@ -27,10 +22,10 @@ msgstr "Fréquence de vérification de l'état de la session"
#. module: pos_check_session_state
#. openerp-web
-#: code:addons/pos_check_session_state/static/src/xml/pos_check_session_state.xml:24
+#: code:addons/pos_check_session_state/static/src/js/chrome.js:45
#, python-format
-msgid "Please close the current Point Of Sale Window and open it again to use a correct session."
-msgstr "Veuillez fermer la fenêtre courante du point de vente et en ouvrir une autre, afin d'utiliser une session correcte."
+msgid "This PoS window will be closed and you'll have to open a new session."
+msgstr "Cette fenêtre de point de vente sera fermée et vous devrez ouvrir une nouvelle sessions."
#. module: pos_check_session_state
#: model:ir.model,name:pos_check_session_state.model_pos_config
@@ -39,20 +34,28 @@ msgstr "Paramétrage du point de vente"
#. module: pos_check_session_state
#. openerp-web
-#: code:addons/pos_check_session_state/static/src/xml/pos_check_session_state.xml:19
+#: code:addons/pos_check_session_state/static/src/js/chrome.js:44
+#, python-format
+msgid "Session not opened : "
+msgstr "Session non ouverte : "
+
+#. module: pos_check_session_state
+#. openerp-web
+#: code:addons/pos_check_session_state/static/src/js/chrome.js:49
#, python-format
-msgid "The session you're working on is closed."
-msgstr "La sessions sur laquelle vous travaillez est close."
+msgid "The session you're working on is closed : "
+msgstr "La sessions sur laquelle vous travaillez est fermée : "
#. module: pos_check_session_state
#. openerp-web
-#: code:addons/pos_check_session_state/static/src/xml/pos_check_session_state.xml:14
+#: code:addons/pos_check_session_state/static/src/js/chrome.js:47
#, python-format
-msgid "The session you're working on is in closing control."
-msgstr "La sessions sur laquelle vous travaillez est en contrôle de fermeture."
+msgid "The session you're working on is in closing control : "
+msgstr "La session sur laquelle vous travaillez est en contrôle de fermeture : "
#. module: pos_check_session_state
#: model:ir.model.fields,help:pos_check_session_state.field_pos_config__check_session_state_frequency
+#: model_terms:ir.ui.view,arch_db:pos_check_session_state.view_pos_config_form
msgid "The value is set in seconds."
msgstr "La valeur est définie en seconde."
diff --git a/pos_check_session_state/models/pos_config.py b/pos_check_session_state/models/pos_config.py
index 447bfc31..7d341968 100644
--- a/pos_check_session_state/models/pos_config.py
+++ b/pos_check_session_state/models/pos_config.py
@@ -2,7 +2,7 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-from openerp import fields, models
+from odoo import fields, models
class PosConfig(models.Model):
diff --git a/pos_check_session_state/readme/DESCRIPTION.rst b/pos_check_session_state/readme/DESCRIPTION.rst
index c0266ca5..44def5e4 100644
--- a/pos_check_session_state/readme/DESCRIPTION.rst
+++ b/pos_check_session_state/readme/DESCRIPTION.rst
@@ -2,15 +2,16 @@
In Point Of Sale module, the front-end works offline, so all datas are
loaded at the beginning.
-At the end of the session, if user do not close the window, it will be
-possible to create new pos order on a closed session, generating errors.
+At the end of the session, if user doesn't close the window, it will be
+possible to create new PoS order on a closed session, generating errors.
**Functionality**
-* This module prevent the possility to create a pos order via the front
- end PoS UI, when session is closed.
-* The session state is checked every minute by default. If the state of the
- session is not opened, a blocking pop up is displayed, and user has to
- reload the current page.
+This module prevent the possility to create a PoS order via the front
+end PoS UI, when session is closed.
+
+The session state is checked every minute by default. If the state of the
+session is not opened, a blocking pop up is displayed, and user has to
+open a new session.
.. figure:: ../static/description/error_message.png
diff --git a/pos_check_session_state/static/description/error_message.png b/pos_check_session_state/static/description/error_message.png
index eeace3f9..22467cd8 100644
Binary files a/pos_check_session_state/static/description/error_message.png and b/pos_check_session_state/static/description/error_message.png differ
diff --git a/pos_check_session_state/static/description/pos_config_form.png b/pos_check_session_state/static/description/pos_config_form.png
index 09684305..c71ca079 100644
Binary files a/pos_check_session_state/static/description/pos_config_form.png and b/pos_check_session_state/static/description/pos_config_form.png differ
diff --git a/pos_check_session_state/static/src/js/pos_check_session_state.js b/pos_check_session_state/static/src/js/chrome.js
similarity index 62%
rename from pos_check_session_state/static/src/js/pos_check_session_state.js
rename to pos_check_session_state/static/src/js/chrome.js
index 2baa4065..3c66a24a 100644
--- a/pos_check_session_state/static/src/js/pos_check_session_state.js
+++ b/pos_check_session_state/static/src/js/chrome.js
@@ -4,14 +4,13 @@ Copyright (C) 2015-Today GRAP (http://www.grap.coop)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
-odoo.define('pos_check_session_state.pos_check_session_state', function (require){
+odoo.define('pos_check_session_state.chrome', function (require){
"use strict";
- var PopupWidget = require('point_of_sale.popups');
- var gui = require('point_of_sale.gui');
- var chrome = require('point_of_sale.chrome');
-
var rpc = require('web.rpc');
+ var core = require('web.core');
+ var chrome = require('point_of_sale.chrome');
+ var _t = core._t;
/*
Overload build_widgets to add a check done every
@@ -42,8 +41,21 @@ odoo.define('pos_check_session_state.pos_check_session_state', function (require
rpc.query(params)
.then(function(sessions){
if (sessions[0].state !== 'opened') {
+ var title = _t("Session not opened : ") + self.pos.pos_session.name;
+ var body = _t("This PoS window will be closed and you'll have to open a new session.");
+ if ((sessions[0].state) !== 'closing_control') {
+ body = _t("The session you're working on is in closing control : ") + body;
+ } else {
+ body = _t("The session you're working on is closed : ") + body;
+ }
// warn user if current session is not opened
- self.gui.show_popup('error-closed-session', {session_state: sessions[0].state});
+ self.gui.show_popup('error', {
+ 'title': title,
+ 'body': body,
+ cancel: function(){
+ self.gui.close();
+ },
+ });
clearInterval(self.intervalIDCheckSessionState);
}
})
@@ -54,26 +66,4 @@ odoo.define('pos_check_session_state.pos_check_session_state', function (require
}
});
- /*
- Define : New ErrorClosedSessionPopupWidget Widget.
- This pop up will be shown if the current pos.session of the PoS is not
- in an 'open' state;
- The check will be done depending on a parameter on the PoS config
- */
- var ErrorClosedSessionPopupWidget = PopupWidget.extend({
- template: 'ErrorClosedSessionPopupWidget',
-
- show: function(options){
- this._super(options);
- this.gui.play_sound('error');
- },
-
- });
-
- gui.define_popup({name:'error-closed-session', widget: ErrorClosedSessionPopupWidget});
-
- return {
- ErrorClosedSessionPopupWidget: ErrorClosedSessionPopupWidget,
- };
-
});
diff --git a/pos_check_session_state/static/src/xml/pos_check_session_state.xml b/pos_check_session_state/static/src/xml/pos_check_session_state.xml
deleted file mode 100644
index 3285ce36..00000000
--- a/pos_check_session_state/static/src/xml/pos_check_session_state.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- The session you're working on is in closing control.
-
-
-
-
- The session you're working on is closed.
-
-
-
-
- Please close the current Point Of Sale Window and open it again to use a correct session.
-