From a4f3f8cf99a921d207fef64fff37a42d5e85c9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Todorovich?= Date: Fri, 14 Feb 2020 19:42:05 +0530 Subject: [PATCH] [MIG] pos_quick_logout: Migration to 12.0 --- pos_quick_logout/README.rst | 67 ------------------- pos_quick_logout/__init__.py | 1 - pos_quick_logout/__manifest__.py | 6 +- pos_quick_logout/models/__init__.py | 1 - pos_quick_logout/models/pos_config.py | 1 - pos_quick_logout/readme/CONTRIBUTORS.rst | 2 + pos_quick_logout/readme/DESCRIPTION.rst | 19 ++++++ .../static/src/js/pos_quick_logout.js | 38 ++++++----- .../xml/templates.xml => views/assets.xml} | 8 ++- pos_quick_logout/views/pos_config_view.xml | 19 +++++- 10 files changed, 65 insertions(+), 97 deletions(-) delete mode 100644 pos_quick_logout/README.rst create mode 100644 pos_quick_logout/readme/CONTRIBUTORS.rst create mode 100644 pos_quick_logout/readme/DESCRIPTION.rst rename pos_quick_logout/{static/src/xml/templates.xml => views/assets.xml} (67%) diff --git a/pos_quick_logout/README.rst b/pos_quick_logout/README.rst deleted file mode 100644 index 3e23dc98..00000000 --- a/pos_quick_logout/README.rst +++ /dev/null @@ -1,67 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - -================== -PoS - Quick Logout -================== - -This module was written to extend the functionality of Odoo Point Of Sale about -changing of cashier. - -This module add a simple button 'Log Out' available in Point Of Sale Front End -UI. This button is available when the cashier is not the initial user logged in -Odoo. It allows to log out quickly, wihout selecting again the user in the -list. This module is useful for users that use regularly the change of cashier, -especialy with 'pos_access_right', when users doesn't have the right to do some -actions like set discount, change unit price, ... - -Implemented Features --------------------- - -* By default, the header is unchanged - -.. image:: /pos_quick_logout/static/description/cashier_user_identical.png - - -* If the cashier changed, and is not the user logged in Odoo, the extra button appears - -.. image:: /pos_quick_logout/static/description/cashier_user_different.png - -Usage -===== - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/184/9.0 - -Bug Tracker -=========== - -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. - -Credits -======= - -Contributors ------------- - -* Sylvain LE GAL - -Maintainer ----------- - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -This module is maintained by the OCA. - -OCA, or the Odoo Community Association, is a nonprofit organization whose -mission is to support the collaborative development of Odoo features and -promote its widespread use. - -To contribute to this module, please visit https://odoo-community.org. diff --git a/pos_quick_logout/__init__.py b/pos_quick_logout/__init__.py index a0fdc10f..0650744f 100644 --- a/pos_quick_logout/__init__.py +++ b/pos_quick_logout/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- from . import models diff --git a/pos_quick_logout/__manifest__.py b/pos_quick_logout/__manifest__.py index 0dbfb794..64213599 100644 --- a/pos_quick_logout/__manifest__.py +++ b/pos_quick_logout/__manifest__.py @@ -1,12 +1,10 @@ -# -*- coding: utf-8 -*- # Copyright (C) 2016-Today: La Louve () # @author: Sylvain LE GAL (https://twitter.com/legalsylvain) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - { 'name': 'Point of Sale - Quick Logout', - 'version': '10.0.1.0.0', + 'version': '12.0.1.0.0', 'category': 'Point Of Sale', 'summary': 'Allow PoS user to logout quickly after user changed', 'license': 'AGPL-3', @@ -17,7 +15,7 @@ ], 'data': [ 'views/pos_config_view.xml', - 'static/src/xml/templates.xml', + 'views/assets.xml', ], 'qweb': [ 'static/src/xml/pos_quick_logout.xml', diff --git a/pos_quick_logout/models/__init__.py b/pos_quick_logout/models/__init__.py index e77b6015..db8634ad 100644 --- a/pos_quick_logout/models/__init__.py +++ b/pos_quick_logout/models/__init__.py @@ -1,2 +1 @@ -# -*- coding: utf-8 -*- from . import pos_config diff --git a/pos_quick_logout/models/pos_config.py b/pos_quick_logout/models/pos_config.py index 55106238..17a8b0d3 100644 --- a/pos_quick_logout/models/pos_config.py +++ b/pos_quick_logout/models/pos_config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from odoo import models, fields diff --git a/pos_quick_logout/readme/CONTRIBUTORS.rst b/pos_quick_logout/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..61ae03c1 --- /dev/null +++ b/pos_quick_logout/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Sylvain LE GAL +* Druidoo diff --git a/pos_quick_logout/readme/DESCRIPTION.rst b/pos_quick_logout/readme/DESCRIPTION.rst new file mode 100644 index 00000000..25300443 --- /dev/null +++ b/pos_quick_logout/readme/DESCRIPTION.rst @@ -0,0 +1,19 @@ +This module was written to extend the functionality of Odoo Point Of Sale about +changing of cashier. + +This module add a simple button 'Log Out' available in Point Of Sale Front End +UI. This button is available when the cashier is not the initial user logged in +Odoo. It allows to log out quickly, wihout selecting again the user in the +list. This module is useful for users that use regularly the change of cashier, +especialy with 'pos_access_right', when users doesn't have the right to do some +actions like set discount, change unit price, ... + + +* By default, the header is unchanged + +.. image:: ../static/description/cashier_user_identical.png + + +* If the cashier changed, and is not the user logged in Odoo, the extra button appears + +.. image:: ../static/description/cashier_user_different.png diff --git a/pos_quick_logout/static/src/js/pos_quick_logout.js b/pos_quick_logout/static/src/js/pos_quick_logout.js index a96cd2a0..4bc169fe 100644 --- a/pos_quick_logout/static/src/js/pos_quick_logout.js +++ b/pos_quick_logout/static/src/js/pos_quick_logout.js @@ -1,20 +1,20 @@ /* Copyright (C) 2016-Today: La Louve () + Copyright (C) 2019-Today: Druidoo () @author: Sylvain LE GAL (https://twitter.com/legalsylvain) License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). */ - -odoo.define('pos_quick_logout.pos_quick_logout', function (require) { +odoo.define('pos_quick_logout.pos_quick_logout', function(require) { "use strict"; var chrome = require('point_of_sale.chrome'); var core = require('web.core'); -/* ******************************************************** -chrome.Chrome -******************************************************** */ + /* ******************************************************** + chrome.Chrome + ******************************************************** */ chrome.Chrome.include({ - start: function(){ + start: function() { var self = this; this._super(); this.timer = false; @@ -22,7 +22,7 @@ chrome.Chrome }, idletimeout: function() { var self = this; - $(document).bind('mousemove keypress mousedown click scroll', function(){ + $(document).bind('mousemove keypress mousedown click scroll', function() { self.resetTimer(); }); }, @@ -36,29 +36,31 @@ chrome.Chrome resetTimer: function() { var self = this; clearTimeout(this.timer); - this.timer = setTimeout(function(){ - self.logout(); - }, self.pos.config.logout_timeout * 1000); + if (self.pos.config && self.pos.config.logout_timeout) { + this.timer = setTimeout(function(){ + self.logout(); + }, self.pos.config.logout_timeout * 1000); + } }, - renderElement: function(){ + renderElement: function() { this._super(); var self = this; - this.$('#pos-quick-logout').click(function(){ + this.$('#pos-quick-logout').click(function() { self.pos.set_cashier(self.pos.user); self.widget.username.renderElement(); }); } }); -/* ******************************************************** -chrome.Chrome -******************************************************** */ + /* ******************************************************** + chrome.Chrome + ******************************************************** */ chrome.UsernameWidget.include({ - renderElement: function(){ + renderElement: function() { this._super(); - if (this.pos.user.id === this.pos.get_cashier().id){ + if (this.pos.user.id === this.pos.get_cashier().id) { $('#pos-quick-logout').hide(); - }else{ + } else { $('#pos-quick-logout').show(); } } diff --git a/pos_quick_logout/static/src/xml/templates.xml b/pos_quick_logout/views/assets.xml similarity index 67% rename from pos_quick_logout/static/src/xml/templates.xml rename to pos_quick_logout/views/assets.xml index 8f854d22..740ecbaf 100644 --- a/pos_quick_logout/static/src/xml/templates.xml +++ b/pos_quick_logout/views/assets.xml @@ -6,12 +6,16 @@ --> +