Browse Source

[IMP] various things, cortesy @MeetKD and @chienandalu

[REF] rename files
[UPD] update description images
pull/387/head
Sylvain LE GAL 4 years ago
parent
commit
2b5251410b
  1. 4
      pos_check_session_state/__manifest__.py
  2. 35
      pos_check_session_state/i18n/fr.po
  3. 2
      pos_check_session_state/models/pos_config.py
  4. 15
      pos_check_session_state/readme/DESCRIPTION.rst
  5. BIN
      pos_check_session_state/static/description/error_message.png
  6. BIN
      pos_check_session_state/static/description/pos_config_form.png
  7. 46
      pos_check_session_state/static/src/js/chrome.js
  8. 34
      pos_check_session_state/static/src/xml/pos_check_session_state.xml
  9. 2
      pos_check_session_state/views/templates.xml
  10. 17
      pos_check_session_state/views/view_pos_config.xml

4
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',

35
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."

2
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):

15
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

BIN
pos_check_session_state/static/description/error_message.png

Before

Width: 599  |  Height: 490  |  Size: 50 KiB

After

Width: 493  |  Height: 396  |  Size: 20 KiB

BIN
pos_check_session_state/static/description/pos_config_form.png

Before

Width: 780  |  Height: 472  |  Size: 41 KiB

After

Width: 1085  |  Height: 383  |  Size: 38 KiB

46
pos_check_session_state/static/src/js/pos_check_session_state.js → 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,
};
});

34
pos_check_session_state/static/src/xml/pos_check_session_state.xml

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2015-Today GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<templates id="template" xml:space="preserve">
<t t-name="ErrorClosedSessionPopupWidget">
<div role="cialog" class="modal-dialog">
<div class="popup popup-error">
<p class="title"><t t-esc="widget.pos.pos_session.name" /></p>
<t t-if="widget.options.session_state === 'closing_control'">
<p class="body">
The session you're working on is in closing control.
</p>
</t>
<t t-if="widget.options.session_state === 'closed'">
<p class="body">
The session you're working on is closed.
</p>
</t>
<p class="body">
Please close the current Point Of Sale Window and open it again to use a correct session.
</p>
</div>
</div>
</t>
</templates>

2
pos_check_session_state/views/templates.xml

@ -9,7 +9,7 @@ Copyright (C) 2015-Today GRAP (http://www.grap.coop)
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_check_session_state/static/src/js/pos_check_session_state.js"></script>
<script type="text/javascript" src="/pos_check_session_state/static/src/js/chrome.js"/>
</xpath>
</template>

17
pos_check_session_state/views/view_pos_config.xml

@ -11,10 +11,19 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.pos_config_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='title']" position="after">
<group string="Check Session State">
<field name="check_session_state_frequency"/>
</group>
<xpath expr="//field[@name='iface_big_scrollbars']/../.." position="after">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_right_pane">
<label for="check_session_state_frequency"/>
<div class="text-muted">
The value is set in seconds.
</div>
<div class="content-group mt16">
<field name="check_session_state_frequency" required="1"/>
</div>
</div>
</div>
</xpath>
</field>
</record>

Loading…
Cancel
Save