Skip to content

Commit 26e8a69

Browse files
author
Ivan Yelizariev
committed
💣 Support scanning via scanner
1 parent e2c9b02 commit 26e8a69

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pos_wechat/static/src/js/wechat_pay.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ odoo.define('pos_payment_wechat', function(require){
5858
});
5959

6060
},
61+
scan_product: function(parsed_code){
62+
// TODO: do we need to make this optional?
63+
var value = parsed_code.code;
64+
if (this.wechat.check_auth_code(value)){
65+
this.wechat.process_qr(value);
66+
return true;
67+
}
68+
return PosModelSuper.prototype.scan_product.apply(this, arguments);
69+
},
6170
on_micropay: function(msg){
6271
var order = this.get('orders').find(function(item){
6372
return item.uid === msg.order_ref;
@@ -117,7 +126,7 @@ odoo.define('pos_payment_wechat', function(require){
117126
});
118127
},
119128
check_auth_code: function(code) {
120-
return true; // for DEBUG
129+
// TODO: do we need to integrate this with barcode.nomenclature?
121130
if (code && Number.isInteger(+code) &&
122131
code.length === 18 &&
123132
+code[0] === 1 && (+code[1] >= 0 && +code[1] <= 5)) {

0 commit comments

Comments
 (0)