From 26e8a697e764a2644d5882b4145cad1e56dc4eb4 Mon Sep 17 00:00:00 2001 From: Ivan Yelizariev Date: Thu, 12 Jul 2018 10:09:20 +0500 Subject: [PATCH] :bomb: Support scanning via scanner --- pos_wechat/static/src/js/wechat_pay.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pos_wechat/static/src/js/wechat_pay.js b/pos_wechat/static/src/js/wechat_pay.js index 508cee33ce..6561b6652f 100644 --- a/pos_wechat/static/src/js/wechat_pay.js +++ b/pos_wechat/static/src/js/wechat_pay.js @@ -58,6 +58,15 @@ odoo.define('pos_payment_wechat', function(require){ }); }, + scan_product: function(parsed_code){ + // TODO: do we need to make this optional? + var value = parsed_code.code; + if (this.wechat.check_auth_code(value)){ + this.wechat.process_qr(value); + return true; + } + return PosModelSuper.prototype.scan_product.apply(this, arguments); + }, on_micropay: function(msg){ var order = this.get('orders').find(function(item){ return item.uid === msg.order_ref; @@ -117,7 +126,7 @@ odoo.define('pos_payment_wechat', function(require){ }); }, check_auth_code: function(code) { - return true; // for DEBUG + // TODO: do we need to integrate this with barcode.nomenclature? if (code && Number.isInteger(+code) && code.length === 18 && +code[0] === 1 && (+code[1] >= 0 && +code[1] <= 5)) {