From 5b18d3252e45b640e74498b2a304726bb0f5ddf1 Mon Sep 17 00:00:00 2001 From: Juliana Date: Thu, 29 Jul 2021 09:51:00 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20fonctionnalit=C3=A9=20Pes?= =?UTF-8?q?=C3=A9e=20sans=20contenant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __manifest__.py | 2 +- models/pos_config.py | 1 + static/src/css/style.css | 7 +++++++ static/src/js/container.js | 39 +++++++++++++++++++++++++++++++------- static/src/xml/pos.xml | 4 ++++ views/pos_config_views.xml | 4 ++++ 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/__manifest__.py b/__manifest__.py index 39161d7..7c60e92 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,7 +1,7 @@ { "name": "VRACOOP - POS Free Balance V2", "summary": "VRACOOP - POS Free Balance V2", - "version": "12.2.0.1", + "version": "12.2.1.0", "development_status": "Beta", "author": "Le Filament", "maintainers": ["remi-filament"], diff --git a/models/pos_config.py b/models/pos_config.py index bb6c632..59c3bcd 100644 --- a/models/pos_config.py +++ b/models/pos_config.py @@ -19,6 +19,7 @@ class PosConfig(models.Model): logo_path = fields.Char( "URL Logo", compute="_compute_image_path") is_comptoir = fields.Boolean("Est une balance comptoir") + allow_without_container = fields.Boolean("Autoriser les pesées sans contenant") def _compute_image_path(self): for pos in self: diff --git a/static/src/css/style.css b/static/src/css/style.css index f092e1f..4141d76 100644 --- a/static/src/css/style.css +++ b/static/src/css/style.css @@ -115,6 +115,7 @@ margin: 0px 16px 0px 16px; } +.pos .presentation-screen .bypass-container, .pos .confirmation-screen .btn-back, .pos .balancecontainerscale-screen .add-container, .pos .scale-screen-custo .add-transaction{ @@ -130,6 +131,12 @@ cursor: pointer; } +.pos .presentation-screen .bypass-container{ + width: 400px; + font-size: 25px; + margin: 20px auto; +} + .pos .confirmation-screen .btn-back{ margin: 20px; width: 300px; diff --git a/static/src/js/container.js b/static/src/js/container.js index 8fe483a..3a35b98 100644 --- a/static/src/js/container.js +++ b/static/src/js/container.js @@ -582,7 +582,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) orderline.set_tare_mode('AUTO'); orderline.trigger('change', orderline); } else { - this._super(); + this.pos.get_order().add_product(product,{ quantity: this.weight }); } }, @@ -607,8 +607,11 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) var qrcode = ''; var ean13 = ''; var ean13_verif = ''; - fields['qrcode'] = qrcode.concat('https://qr.mayam.fr/', container.barcode); - fields['container_ean13'] = container.barcode; + + if (container){ + fields['qrcode'] = qrcode.concat('https://qr.mayam.fr/', container.barcode); + fields['container_ean13'] = container.barcode; + } fields['product_id'] = product.id; // var product_id = (this.get_product().id).toString(); @@ -637,7 +640,12 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) fields['write_date'] = date_time; fields['weight_net'] = scale_screen.weight; - fields['weight_tare'] = container.weight; + if(container){ + fields['weight_tare'] = container.weight; + } + else{ + fields['weight_tare'] = 0.0; + } var pricelist = scale_screen._get_active_pricelist(); fields['price_product'] = (product ? product.get_price(pricelist, scale_screen.weight) : 0) || 0; @@ -837,6 +845,17 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) screen.$el.removeClass('oe_hidden'); $("#pos-header-text-selec").removeClass('oe_hidden'); $("#pos-header-text-confirm").addClass('oe_hidden'); + +// Ajout de la fonctionnalité Pesée sans contenant + if (this.pos.config.allow_without_container){ + this.$('.bypass-container').removeClass('oe_hidden'); + } + else { + this.$('.bypass-container').addClass('oe_hidden'); + } + this.$('.bypass-container').click(function(){ + self.gui.show_screen('products-balance'); + }); }, // this methods hides the screen. It's not a good place to put your cleanup stuff as it is called on the @@ -902,10 +921,16 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) var scale_screen = this.gui.screen_instances['balancescale']; var container = this.gui.get_current_screen_param('container'); - - scale_screen.weight_container = container.weight; + + if (container){ + var container_weight = container.weight; + } + else{ + var container_weight = 0.0 + } + scale_screen.weight_container = container_weight; scale_screen.weight = weight; - scale_screen.weight_brut = container.weight + scale_screen.weight; + scale_screen.weight_brut = container_weight + scale_screen.weight; scale_screen.$('.weight').text(scale_screen.get_product_weight_string()); scale_screen.$('.computed-price').text(scale_screen.get_computed_price_string()); scale_screen.$('.weight-brut').text(scale_screen.get_product_weight_string_brut()); diff --git a/static/src/xml/pos.xml b/static/src/xml/pos.xml index bddd051..d36e51e 100644 --- a/static/src/xml/pos.xml +++ b/static/src/xml/pos.xml @@ -36,6 +36,10 @@
+
+ Transaction sans contenant +
+ diff --git a/views/pos_config_views.xml b/views/pos_config_views.xml index d3de6cc..abf3219 100644 --- a/views/pos_config_views.xml +++ b/views/pos_config_views.xml @@ -54,6 +54,10 @@