From 816235bcdeb84d5de1c474f46debd1fb54563f60 Mon Sep 17 00:00:00 2001 From: Juliana Date: Thu, 7 Jan 2021 13:33:21 +0100 Subject: [PATCH] Ajout coche Est comptoir, change fonctionnement container --- models/pos_config.py | 1 + static/src/css/style.css | 4 ++-- static/src/js/container.js | 24 ++++++++++++++++-------- static/src/js/models_and_db.js | 6 ++++++ views/pos_config_views.xml | 4 ++++ 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/models/pos_config.py b/models/pos_config.py index ececd92..fbe07f8 100644 --- a/models/pos_config.py +++ b/models/pos_config.py @@ -17,6 +17,7 @@ class PosConfig(models.Model): balance_id = fields.Char("Identifiant de la balance") logo_path = fields.Char( "URL Logo", compute="_compute_image_path") + is_comptoir = fields.Boolean("Est une balance comptoir") def _compute_image_path(self): for pos in self: diff --git a/static/src/css/style.css b/static/src/css/style.css index 1ccf67b..73f0dc6 100644 --- a/static/src/css/style.css +++ b/static/src/css/style.css @@ -380,10 +380,10 @@ h1.product-name { .pos-bottom.pos-bottom-confirm{ height: 100%; } - +/* .searchbox{ display: none; -} +}*/ .pos .product-list-scroller{ padding-bottom: 200px; diff --git a/static/src/js/container.js b/static/src/js/container.js index 4f55a59..f3496b0 100644 --- a/static/src/js/container.js +++ b/static/src/js/container.js @@ -313,7 +313,9 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) self.set_weight(scale_answer.weight); if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) { self.gui.show_screen(self.next_screen); - self.create_container(); + if (this.pos.config.is_comptoir) { + self.create_container(); + } } }); }, {duration: 500, repeat: true}); @@ -367,15 +369,21 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) selected_order.add_container(container); - self.gui.show_popup('confirm-pesee',{ - 'title': _t('Merci'), - 'body': _t('Contenant ajouté, vous pouvez vous servir'), - confirm: function(){ - self.gui.show_screen(self.next_screen); - }, - }); + if (this.pos.config.is_comptoir) { + self.gui.show_screen(self.next_screen); + } + else{ + self.gui.show_popup('confirm-pesee',{ + 'title': _t('Merci'), + 'body': _t('Contenant ajouté, vous pouvez vous servir'), + confirm: function(){ + self.gui.show_screen(self.next_screen); + }, + }); + } }, + close: function(){ this._super(); if (this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard) { diff --git a/static/src/js/models_and_db.js b/static/src/js/models_and_db.js index ac2a9d1..0baae65 100644 --- a/static/src/js/models_and_db.js +++ b/static/src/js/models_and_db.js @@ -152,6 +152,12 @@ odoo.define('vracoop_pos_free_balance_v2.models_and_db_balance', function (requi } }, + get_is_comptoir: function(){ + if (this.config.is_comptoir) { + return this.config.is_comptoir; + } + }, + // load_placeholder_transactions: function(){ // var self = this; // var fields = _.find(this.models,function(model){ diff --git a/views/pos_config_views.xml b/views/pos_config_views.xml index 33c293d..b3d9221 100644 --- a/views/pos_config_views.xml +++ b/views/pos_config_views.xml @@ -22,6 +22,10 @@