[FIX] point_of_sale: fix use iot proxy address
When you are in odoo community, you have to set an ip adress to configure iot box and check boxes to add devices to your POS. When you use the devices in POS this way, you get a traceback because of trying use 'this' which is not the correct scope of the function. To avoid such issue, we are using arrow functions that keep the 'this' of wherer they are called. closes odoo/odoo#100226 X-original-commit: aaa0f836dfce9efa27e9b2603edddd68781c2048 Signed-off-by: Masereel Pierre <pim@odoo.com>
This commit is contained in:
@@ -206,20 +206,20 @@ odoo.define('point_of_sale.Chrome', function(require) {
|
||||
}
|
||||
|
||||
connect_to_proxy() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.env.barcode_reader.disconnect_from_proxy();
|
||||
this.state.loadingSkipButtonIsShown = true;
|
||||
this.env.proxy.autoconnect({
|
||||
force_ip: this.env.pos.config.proxy_ip || undefined,
|
||||
progress: function(prog){},
|
||||
}).then(
|
||||
function () {
|
||||
() => {
|
||||
if (this.env.pos.config.iface_scan_via_proxy) {
|
||||
this.env.barcode_reader.connect_to_proxy();
|
||||
}
|
||||
resolve();
|
||||
},
|
||||
function (statusText, url) {
|
||||
(statusText, url) => {
|
||||
// this should reject so that it can be captured when we wait for pos.ready
|
||||
// in the chrome component.
|
||||
// then, if it got really rejected, we can show the error.
|
||||
|
||||
@@ -447,7 +447,7 @@ var ProxyDevice = core.Class.extend(mixins.PropertiesMixin,{
|
||||
},
|
||||
|
||||
update_customer_facing_display: function(html) {
|
||||
if (this.posbox_supports_display) {
|
||||
if (this.posbox_supports_display && this.get('status').status == 'connected') {
|
||||
return this.message('customer_facing_display',
|
||||
{ html: html },
|
||||
{ timeout: 5000 });
|
||||
|
||||
Reference in New Issue
Block a user