From 875a2f98946b0777d059278d6a5f995725c18043 Mon Sep 17 00:00:00 2001 From: Kiril Vangelovski Date: Mon, 7 Oct 2019 21:55:45 +0200 Subject: [PATCH] pos_cashier_login: add config to enable/disable --- pos_cashier_login/__init__.py | 3 +++ pos_cashier_login/__manifest__.py | 3 ++- pos_cashier_login/models/__init__.py | 3 +++ pos_cashier_login/models/pos_config.py | 11 ++++++++ pos_cashier_login/static/src/js/main.js | 6 +++-- .../views/{main.xml => assets.xml} | 1 + pos_cashier_login/views/pos_config.xml | 25 +++++++++++++++++++ 7 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 pos_cashier_login/models/__init__.py create mode 100644 pos_cashier_login/models/pos_config.py rename pos_cashier_login/views/{main.xml => assets.xml} (84%) create mode 100644 pos_cashier_login/views/pos_config.xml diff --git a/pos_cashier_login/__init__.py b/pos_cashier_login/__init__.py index e69de29b..6ac02ac2 100644 --- a/pos_cashier_login/__init__.py +++ b/pos_cashier_login/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2019 by Lambda IS + +from . import models diff --git a/pos_cashier_login/__manifest__.py b/pos_cashier_login/__manifest__.py index 2a3f3624..02756087 100755 --- a/pos_cashier_login/__manifest__.py +++ b/pos_cashier_login/__manifest__.py @@ -12,7 +12,8 @@ 'point_of_sale', ], 'data': [ - 'views/main.xml', + 'views/assets.xml', + 'views/pos_config.xml', ], 'qweb': [ 'static/src/xml/main.xml', diff --git a/pos_cashier_login/models/__init__.py b/pos_cashier_login/models/__init__.py new file mode 100644 index 00000000..ece5c988 --- /dev/null +++ b/pos_cashier_login/models/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2019 by Lambda IS + +from . import pos_config diff --git a/pos_cashier_login/models/pos_config.py b/pos_cashier_login/models/pos_config.py new file mode 100644 index 00000000..b8b09c43 --- /dev/null +++ b/pos_cashier_login/models/pos_config.py @@ -0,0 +1,11 @@ +# Copyright (C) 2019 by Lambda IS + +from odoo import fields, models + + +class POSConfig(models.Model): + _inherit = 'pos.config' + + require_cashier_login = fields.Boolean( + string='Cashier Login', + help='Require for cashier to be selected before each new sale') diff --git a/pos_cashier_login/static/src/js/main.js b/pos_cashier_login/static/src/js/main.js index 087b745d..cfff14a5 100755 --- a/pos_cashier_login/static/src/js/main.js +++ b/pos_cashier_login/static/src/js/main.js @@ -21,8 +21,10 @@ odoo.define('pos_cashier_login.main', function (require) { chrome.Chrome.include({ build_widgets: function() { this._super(); - this.gui.set_startup_screen('cashier-login'); - this.gui.set_default_screen('cashier-login'); + if (this.pos.config.require_cashier_login) { + this.gui.set_startup_screen('cashier-login'); + this.gui.set_default_screen('cashier-login'); + } }, }); diff --git a/pos_cashier_login/views/main.xml b/pos_cashier_login/views/assets.xml similarity index 84% rename from pos_cashier_login/views/main.xml rename to pos_cashier_login/views/assets.xml index 50b1e693..4719f0f8 100644 --- a/pos_cashier_login/views/main.xml +++ b/pos_cashier_login/views/assets.xml @@ -1,4 +1,5 @@ +