Browse Source

Modif TARE sur écran produit

12-V2.0
Juliana 4 years ago
parent
commit
97b8f6558d
  1. 105
      static/src/js/container.js

105
static/src/js/container.js

@ -37,31 +37,31 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
var scale_screen = this.gui.screen_instances['balancescale'];
var price = scale_screen.format_price(scale_screen.get_product_price());
if (container) {
// format tare
var tare = this.format_tare(container);
queue.schedule(function () {
return self.pos.proxy.scale_read_data_price_tare(price, tare).then(function (scale_answer) {
self.set_weight(scale_answer.weight);
// if (container) {
// // format tare
// var tare = this.format_tare(container);
// queue.schedule(function () {
// return self.pos.proxy.scale_read_data_price_tare(price, tare).then(function (scale_answer) {
// self.set_weight(scale_answer.weight);
if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) {
self.set_weight(0);
self.pos.proxy.reset_tare();
}
});
}, {duration: 500, repeat: true});
} else {
queue.schedule(function () {
return self.pos.proxy.scale_read_data_price(price).then(function (scale_answer) {
self.set_weight(scale_answer.weight);
// self.set_price(scale_answer.price);
if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) {
self.set_weight(0);
}
});
}, {duration: 500, repeat: true});
}
// if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) {
// self.set_weight(0);
// self.pos.proxy.reset_tare();
// }
// });
// }, {duration: 500, repeat: true});
// } else {
queue.schedule(function () {
return self.pos.proxy.scale_read_data_price(price).then(function (scale_answer) {
self.set_weight(scale_answer.weight);
// self.set_price(scale_answer.price);
if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) {
self.set_weight(0);
}
});
}, {duration: 500, repeat: true});
// }
this._super();
@ -733,7 +733,53 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
previous_screen: 'presentation',
show: function(){
var self = this;
var queue = this.pos.proxy_queue;
var container = this.gui.get_current_screen_param('container');
queue.schedule(function () {
return self.pos.proxy.reset_weight().then(function () {
self.set_weight(0);
self.set_price(0);
});
}, {duration: 500});
// format price
var scale_screen = this.gui.screen_instances['balancescale'];
var price = scale_screen.format_price(scale_screen.get_product_price());
// var price = this.format_price(this.get_product_price());
if (container) {
// format tare
var tare = this.format_tare(container);
queue.schedule(function () {
return self.pos.proxy.scale_read_data_price_tare(price, tare).then(function (scale_answer) {
self.set_weight(scale_answer.weight);
self.set_price(scale_answer.price);
if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) {
self.gui.show_screen(self.next_screen);
// add product *after* switching screen to scroll properly
self.order_product();
self.pos.proxy.reset_tare();
}
});
}, {duration: 500, repeat: true});
} else {
queue.schedule(function () {
return self.pos.proxy.scale_read_data_price(price).then(function (scale_answer) {
self.set_weight(scale_answer.weight);
self.set_price(scale_answer.price);
if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) {
self.gui.show_screen(self.next_screen);
// add product *after* switching screen to scroll properly
self.order_product();
}
});
}, {duration: 500, repeat: true});
}
// this._super();
this._super();
var self = this;
@ -747,7 +793,14 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
this.$('.back').click(function(){
self.gui.show_screen('presentation');
});
// Ajout pour le pb de tare
var container = this.gui.get_current_screen_param('container');
if (container) {
this.pos.proxy.reset_tare();
}
// Ajout pour le pb de tare
$("#pos-header-text-prod").removeClass('oe_hidden');
},

Loading…
Cancel
Save