[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:
Pierre Masereel
2022-09-15 16:08:26 +02:00
parent af436cc93f
commit 1e7d625770
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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 });