|
|
@ -48,6 +48,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
} |
|
|
|
}); |
|
|
|
}, {duration: 500, repeat: true}); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
this._super(); |
|
|
@ -61,7 +62,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
}, |
|
|
|
|
|
|
|
set_weight: function(weight){ |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
scale_screen.weight = weight; |
|
|
|
scale_screen.$('.weight').text(scale_screen.get_product_weight_string()); |
|
|
@ -70,26 +70,17 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
|
|
|
|
var container_text = '0.000 kg' |
|
|
|
scale_screen.$('.tare-container').text(container_text); |
|
|
|
} |
|
|
|
else { |
|
|
|
this._super(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
set_price: function (price) { |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
scale_screen.price = price; |
|
|
|
scale_screen.$('.computed-price').text(scale_screen.format_currency(0)); |
|
|
|
} |
|
|
|
else { |
|
|
|
this._super(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
barcode_container_action: function(code){ |
|
|
|
var self = this; |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
|
|
|
|
if (self.pos.scan_container(code)) { |
|
|
|
var order = this.pos.get_order(); |
|
|
|
var selected_orderline = order.get_selected_orderline(); |
|
|
@ -114,9 +105,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
} else { |
|
|
|
self.gui.show_screen('balancecontainerscale', {barcode: code.base_code}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this._super(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
delete_selected_transaction: function(transaction, barcode){ |
|
|
@ -185,7 +173,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
|
|
|
|
show: function(){ |
|
|
|
var self = this; |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
var queue = this.pos.proxy_queue; |
|
|
|
|
|
|
|
this.set_weight(0); |
|
|
@ -241,10 +228,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
}); |
|
|
|
|
|
|
|
$("#pos-header-text-peser").removeClass('oe_hidden'); |
|
|
|
} else { |
|
|
|
this._super(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -412,8 +395,11 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
}); |
|
|
|
|
|
|
|
gui.define_screen({ |
|
|
|
name:'balancescale', |
|
|
|
widget: BalanceScaleScreenWidget, |
|
|
|
'name':'balancescale', |
|
|
|
'widget': BalanceScaleScreenWidget, |
|
|
|
'condition': function(){ |
|
|
|
return this.pos.config.balance_id; |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -427,46 +413,47 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
start: 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.set_weight(0);
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// }, {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});
|
|
|
|
// }
|
|
|
|
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.set_weight(0); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, {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();
|
|
|
|
|
|
|
|
this.actionpad = new screens.ActionpadWidget(this,{}); |
|
|
|
this.actionpad.replace(this.$('.placeholder-ActionpadWidget')); |
|
|
@ -503,7 +490,8 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
if (_.size(this.action_buttons)) { |
|
|
|
this.$('.control-buttons').removeClass('oe_hidden'); |
|
|
|
} |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
|
|
|
|
var self = this; |
|
|
|
|
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
|
|
|
@ -524,7 +512,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
// Ajout pour le pb de tare
|
|
|
|
|
|
|
|
$("#pos-header-text-prod").removeClass('oe_hidden'); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -535,26 +522,34 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
var screen = this.gui.screen_instances['products-balance']; |
|
|
|
}, |
|
|
|
|
|
|
|
// set_weight: function(weight){
|
|
|
|
// var scale_screen = this.gui.screen_instances['balancescale'];
|
|
|
|
//
|
|
|
|
// var container = this.gui.get_current_screen_param('container');
|
|
|
|
//
|
|
|
|
// scale_screen.weight_container = container.weight;
|
|
|
|
// scale_screen.weight = weight;
|
|
|
|
// scale_screen.weight_brut = container.weight + scale_screen.weight;
|
|
|
|
// scale_screen.$('.weight').text(scale_screen.get_product_weight_string());
|
|
|
|
// scale_screen.$('.computed-price').text(scale_screen.format_currency(scale_screen.get_product_price() * 0));
|
|
|
|
// scale_screen.$('.weight-brut').text(scale_screen.get_product_weight_string_brut());
|
|
|
|
//
|
|
|
|
// if (container){
|
|
|
|
// var container_text = (container.weight || 0).toFixed(3) + ' kg';
|
|
|
|
// }
|
|
|
|
// else{
|
|
|
|
// var container_text = ''
|
|
|
|
// }
|
|
|
|
// scale_screen.$('.tare-container').text(container_text);
|
|
|
|
// },
|
|
|
|
set_weight: function(weight){ |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
|
|
|
|
var container = this.gui.get_current_screen_param('container'); |
|
|
|
if (container) { |
|
|
|
scale_screen.weight_container = container.weight; |
|
|
|
scale_screen.weight_brut = container.weight + scale_screen.weight; |
|
|
|
} |
|
|
|
scale_screen.weight = weight; |
|
|
|
scale_screen.$('.weight').text(scale_screen.get_product_weight_string()); |
|
|
|
scale_screen.$('.computed-price').text(scale_screen.format_currency(scale_screen.get_product_price() * 0)); |
|
|
|
scale_screen.$('.weight-brut').text(scale_screen.get_product_weight_string_brut()); |
|
|
|
|
|
|
|
if (container){ |
|
|
|
var container_text = (container.weight || 0).toFixed(3) + ' kg'; |
|
|
|
} |
|
|
|
else{ |
|
|
|
var container_text = '' |
|
|
|
} |
|
|
|
scale_screen.$('.tare-container').text(container_text); |
|
|
|
}, |
|
|
|
|
|
|
|
set_price: function (price) { |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
scale_screen.price = price; |
|
|
|
scale_screen.$('.computed-price').text(scale_screen.format_currency(0)); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
click_product: function(product) { |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
@ -643,7 +638,13 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
this.pos.proxy_queue.clear(); |
|
|
|
}, |
|
|
|
}); |
|
|
|
gui.define_screen({name:'products-balance', widget: ProductBalanceScreenWidget}); |
|
|
|
gui.define_screen({ |
|
|
|
'name':'products-balance', |
|
|
|
'widget': ProductBalanceScreenWidget, |
|
|
|
'condition': function(){ |
|
|
|
return this.pos.config.balance_id; |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
/*--------------------------------------*\ |
|
|
|
| THE SCALE SCREEN FREE | |
|
|
@ -667,8 +668,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
show: function(){ |
|
|
|
|
|
|
|
var self = this; |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
|
|
|
|
var queue = this.pos.proxy_queue; |
|
|
|
var priceStr = '001000'; // bizerba doesn't accept '000000' as unit price
|
|
|
|
this.renderElement(); |
|
|
@ -703,10 +702,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
|
|
|
|
$("#pos-header-text-peser").removeClass('oe_hidden'); |
|
|
|
$("#pos-topheader-scale-cont").removeClass('oe_hidden'); |
|
|
|
} else { |
|
|
|
this._super(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -767,8 +762,11 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
}); |
|
|
|
|
|
|
|
gui.define_screen({ |
|
|
|
name:'balancecontainerscale', |
|
|
|
widget: BalanceContainerScaleScreenWidget, |
|
|
|
'name':'balancecontainerscale', |
|
|
|
'widget': BalanceContainerScaleScreenWidget, |
|
|
|
'condition': function(){ |
|
|
|
return this.pos.config.balance_id; |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -798,25 +796,22 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
show: function(){ |
|
|
|
this._super(); |
|
|
|
var self = this; |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
|
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
scale_screen.$el.removeClass('oe_hidden'); |
|
|
|
var screen = this.gui.screen_instances['products-balance']; |
|
|
|
screen.$el.removeClass('oe_hidden'); |
|
|
|
$("#pos-header-text-selec").removeClass('oe_hidden'); |
|
|
|
$("#pos-header-text-confirm").addClass('oe_hidden'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// this methods hides the screen. It's not a good place to put your cleanup stuff as it is called on the
|
|
|
|
// POS initialization.
|
|
|
|
hide: function(){ |
|
|
|
this._super(); |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
var screen = this.gui.screen_instances['products-balance']; |
|
|
|
screen.$el.addClass('oe_hidden'); |
|
|
|
$("#pos-header-text-selec").addClass('oe_hidden'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
@ -888,6 +883,12 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
scale_screen.$('.tare-container').text(container_text); |
|
|
|
}, |
|
|
|
|
|
|
|
set_price: function (price) { |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
scale_screen.price = price; |
|
|
|
scale_screen.$('.computed-price').text(scale_screen.format_currency(0)); |
|
|
|
}, |
|
|
|
|
|
|
|
_get_active_pricelist: function(){ |
|
|
|
var current_order = this.pos.get_order(); |
|
|
|
var current_pricelist = this.pos.default_pricelist; |
|
|
@ -926,6 +927,9 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
gui.define_screen({ |
|
|
|
'name': 'confirmation', |
|
|
|
'widget': ConfirmationScreen, |
|
|
|
'condition': function(){ |
|
|
|
return this.pos.config.balance_id; |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
// Add the Presentation to the GUI, and set it as the default screen
|
|
|
@ -936,16 +940,24 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
this.gui.set_startup_screen('presentation'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
build_chrome: function() { |
|
|
|
this._super(); |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
this.$('.pos-topheader').addClass('oe_hidden'); |
|
|
|
} |
|
|
|
else { |
|
|
|
this.$('.pos-topheader-title').addClass('oe_hidden'); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
gui.Gui.include({ |
|
|
|
show_saved_screen: function(order,options) { |
|
|
|
this._super(); |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
options = options || {}; |
|
|
|
this.close_popup(); |
|
|
|
this.show_screen(this.startup_screen); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
@ -954,14 +966,10 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
chrome.OrderSelectorWidget.include({ |
|
|
|
|
|
|
|
hide: function(){ |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
this.$el.addClass('oe_invisible'); |
|
|
|
} |
|
|
|
}, |
|
|
|
show: function(){ |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
this.$el.removeClass('oe_invisible'); |
|
|
|
} |
|
|
|
}, |
|
|
|
renderElement: function(){ |
|
|
|
var self = this; |
|
|
@ -974,6 +982,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
var CheckBarcodePopupDoublon = popups.extend({ |
|
|
|