diff --git a/__manifest__.py b/__manifest__.py index a0415c48d87fe2cab62fa8983c9f24ce53b47fcb..33d25f91a65277ee6236dc2cb923f21392f1d225 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -1,7 +1,7 @@ { "name": "VRACOOP - POS Balance Container QRCode", "summary": "VRACOOP - POS Balance Container QRCode", - "version": "12.0.1.2.0", + "version": "12.0.1.3.0", "development_status": "Beta", "author": "Le Filament", "maintainers": ["remi-filament"], diff --git a/static/src/js/container.js b/static/src/js/container.js index 72dd069b9c268cc8179b2d8bfeab608150f51297..c65ace0939da4e68f8d80669e6b84bfceaecd4d1 100644 --- a/static/src/js/container.js +++ b/static/src/js/container.js @@ -47,16 +47,18 @@ odoo.define('vracoop_pos_container_qrcode.container_print_qr', function (require var count_it = 0; queue.schedule(function () { return self.pos.proxy.scale_read_data_price(priceStr).then(function (scale_answer) { - self.set_weight(scale_answer.weight); - if (count_it < 6) { - count_it += 1; + + if (count_it < 4) { + count_it += 1; } else { count_it = 0; if (self.weight > 0){ self.print(); + self.gui.show_screen('confirmation'); } } + self.set_weight(scale_answer.weight); if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) { self.set_weight(0); } @@ -74,7 +76,6 @@ odoo.define('vracoop_pos_container_qrcode.container_print_qr', function (require $("#pos-header-text-peser").removeClass('oe_hidden'); $("#pos-topheader-scale-cont").removeClass('oe_hidden'); - //this.render_receipt(); }, @@ -123,18 +124,6 @@ odoo.define('vracoop_pos_container_qrcode.container_print_qr', function (require var url_qrcode = url_qr.concat(code_base36); - // var self = this; - // var get_image_deffered; - // get_image_deffered = this._convert_qr_img_to_base64(url_qrcode); - - // return $.when.apply($, get_image_deffered).then(function(){ - // return { - // widget: self, - // weight: self.weight, - // url_barcode: url_qrcode, - // barcode_base64: self.barcode_base64, - // } - // }) return { widget: this, weight: this.weight, @@ -143,31 +132,6 @@ odoo.define('vracoop_pos_container_qrcode.container_print_qr', function (require }, - _convert_qr_img_to_base64: function (url_qrcode) { - - var deferred = new $.Deferred(); - var img = new Image(); - - img.onload = function () { - var canvas = document.createElement('CANVAS'); - var ctx = canvas.getContext('2d'); - - canvas.height = 200; - canvas.width = 200; - ctx.drawImage(img,0,0); - - var dataURL = canvas.toDataURL('image/jpeg'); - this.barcode_base64 = dataURL; - canvas = null; - - deferred.resolve(); - }; - img.crossOrigin = 'use-credentials'; - img.src = window.location.origin + "/report/barcode/?type=QR&value=" + url_qrcode + "&width=200&height=200"; - - return deferred; - }, - renderElement: function() { var self = this; this._super(); @@ -249,8 +213,34 @@ odoo.define('vracoop_pos_container_qrcode.container_print_qr', function (require }, }); + var ConfirmationScreen = screens.ScreenWidget.extend({ + template: 'ConfirmationScreen', + + next_screen: 'balancecontainerqr', + + show: function(){ + + this._super(); + var self = this; + + setTimeout(function(){ + self.gui.show_screen('balancecontainerqr'); + }, 5000); + + }, + + }); + + gui.define_screen({ + 'name': 'confirmation', + 'widget': ConfirmationScreen, + 'condition': function(){ + return this.pos.config.is_print_container_qr; + }, + }); + - // Add the Presentation to the GUI, and set it as the default screen + // Add the Balance print QR Code to the GUI, and set it as the default screen chrome.Chrome.include({ build_widgets: function(){ this._super(); diff --git a/static/src/xml/pos.xml b/static/src/xml/pos.xml index 206b7c621fb2a4e3c86d8ca98778d4d30911b8bf..7b538712d682a4c21b5df9a0dd566bfe7e1a01d2 100644 --- a/static/src/xml/pos.xml +++ b/static/src/xml/pos.xml @@ -105,4 +105,36 @@ </receipt> </t> + <t t-name="ConfirmationScreen"> + <div class="confirmation-screen screen"> + <div class="pos-topheader-bal"> + <div class="pos-header-custo"> + <div class=""> + <span class='button back'> + <i class='fa fa-angle-double-left'></i> + Retour + </span> + </div> + <div id="pos-header-text-confirm" class="pos-text oe_hidden"> + <ul> + <li><span>1</span></li> + <li><span>2</span></li> + <li class="li-active"><span>3. Pesée confirmée</span></li> + </ul> + </div> + </div> + </div> + <div class="pos-bottom pos-bottom-confirm"> + <div class="pos-confirm-screen"> + <p class="text-center">Merci.<br/> + Vous pouvez passer en caisse</p> + <div class='back-presentation'> + <img class="logo-scan mb-3" src="/vracoop_pos_free_balance_v2/static/src/img/picto-confirm.png" /> + </div> + + </div> + </div> + </div> + </t> + </templates>