diff --git a/__manifest__.py b/__manifest__.py index e7b6c90da293452243fca6269906eab95770a103..a0415c48d87fe2cab62fa8983c9f24ce53b47fcb 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.1.0", + "version": "12.0.1.2.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 463ff70cf4f8cfea97a54ff67a8e4d6adf3f31da..72dd069b9c268cc8179b2d8bfeab608150f51297 100644 --- a/static/src/js/container.js +++ b/static/src/js/container.js @@ -44,13 +44,24 @@ odoo.define('vracoop_pos_container_qrcode.container_print_qr', function (require }); }, {duration: 500}); + 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; + } + else { + count_it = 0; + if (self.weight > 0){ + self.print(); + } + } if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) { self.set_weight(0); } }); + }, {duration: 500, repeat: true}); this._super(); @@ -63,6 +74,7 @@ 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(); }, @@ -111,6 +123,18 @@ 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, @@ -119,24 +143,7 @@ odoo.define('vracoop_pos_container_qrcode.container_print_qr', function (require }, - _convert_qr_img_to_base64: function () { - var mag_name = this.pos.config.mag_id; - var url_qr = this.pos.config.url_qrcode; - var prefixe_qr = this.pos.config.prefixe_qr.toString(); - var timestamp = Math.floor((new Date().getTime())/1000); - - var weight_str = (this.weight * 1000).toString(); - var weight_str = (0.2 * 1000).toString(); - weight_str = ("0000" + weight_str).slice(-4); - - var ean19 = ''; - ean19 = ean19.concat(prefixe_qr,timestamp.toString(),weight_str); - var ean20 = this.pos.barcode_reader.barcode_parser.sanitize_ean19(ean19); - - var ean20_int = parseInt(ean20); - var code_base36 = ean20_int.toString(36); - - var url_qrcode = url_qr.concat(code_base36); + _convert_qr_img_to_base64: function (url_qrcode) { var deferred = new $.Deferred(); var img = new Image(); diff --git a/static/src/xml/pos.xml b/static/src/xml/pos.xml index cc8926fea812e597fb8b17e81207d437c02fa378..206b7c621fb2a4e3c86d8ca98778d4d30911b8bf 100644 --- a/static/src/xml/pos.xml +++ b/static/src/xml/pos.xml @@ -84,7 +84,7 @@ <div> <p>l'image se trouve la</p> - <img t-att-src="url_barcode"/> + <!-- <img t-att-src="barcode_base64"/> --> </div> </div> @@ -99,7 +99,7 @@ ^FX Third section with bar code. ^BY3,2,10 - ^FO60,20^BQ,2,4,H,7^FDQA,<t t-esc='url_barcode'/>^FS + ^FO60,30^BQ,2,5,H,7^FDQA,<t t-esc='url_barcode'/>^FS ^XZ </receipt>