|
|
@ -24,11 +24,13 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
var _t = core._t; |
|
|
|
|
|
|
|
var round_pr = utils.round_precision; |
|
|
|
var action_button_classes = []; |
|
|
|
|
|
|
|
screens.ScreenWidget.include({ |
|
|
|
|
|
|
|
show: function(){ |
|
|
|
var self = this; |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
var queue = this.pos.proxy_queue; |
|
|
|
|
|
|
|
var container = this.gui.get_current_screen_param('container'); |
|
|
@ -37,21 +39,6 @@ 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 ((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); |
|
|
@ -61,7 +48,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
} |
|
|
|
}); |
|
|
|
}, {duration: 500, repeat: true}); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
this._super(); |
|
|
|
|
|
|
@ -74,6 +61,7 @@ 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()); |
|
|
@ -82,17 +70,26 @@ 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(); |
|
|
@ -106,17 +103,20 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
confirm: function(){ |
|
|
|
var transaction = self.pos.scan_container_check(code) |
|
|
|
self.delete_selected_transaction(transaction, code); |
|
|
|
self.gui.show_screen('products', {container: container}); |
|
|
|
self.gui.show_screen('products-balance', {container: container}); |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
self.gui.show_screen('products', {container: container}); |
|
|
|
self.gui.show_screen('products-balance', {container: container}); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
self.gui.show_screen('balancecontainerscale', {barcode: code.base_code}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this._super(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
delete_selected_transaction: function(transaction, barcode){ |
|
|
@ -164,7 +164,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
template: 'BalanceScaleScreenWidget', |
|
|
|
|
|
|
|
next_screen: 'confirmation', |
|
|
|
previous_screen: 'products', |
|
|
|
previous_screen: 'products-balance', |
|
|
|
|
|
|
|
init: function(parent, options){ |
|
|
|
this._super(parent, options); |
|
|
@ -185,6 +185,7 @@ 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); |
|
|
@ -240,6 +241,10 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
}); |
|
|
|
|
|
|
|
$("#pos-header-text-peser").removeClass('oe_hidden'); |
|
|
|
} else { |
|
|
|
this._super(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -412,6 +417,234 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
/* -------- The Product Screen BALANCE -------- */ |
|
|
|
|
|
|
|
var ProductBalanceScreenWidget = screens.ScreenWidget.extend({ |
|
|
|
template:'ProductBalanceScreenWidget', |
|
|
|
|
|
|
|
previous_screen: 'presentation', |
|
|
|
|
|
|
|
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});
|
|
|
|
// }
|
|
|
|
|
|
|
|
this.actionpad = new screens.ActionpadWidget(this,{}); |
|
|
|
this.actionpad.replace(this.$('.placeholder-ActionpadWidget')); |
|
|
|
|
|
|
|
this.numpad = new screens.NumpadWidget(this,{}); |
|
|
|
this.numpad.replace(this.$('.placeholder-NumpadWidget')); |
|
|
|
|
|
|
|
this.order_widget = new screens.OrderWidget(this,{ |
|
|
|
numpad_state: this.numpad.state, |
|
|
|
}); |
|
|
|
this.order_widget.replace(this.$('.placeholder-OrderWidget')); |
|
|
|
|
|
|
|
this.product_list_widget = new screens.ProductListWidget(this,{ |
|
|
|
click_product_action: function(product){ self.click_product(product); }, |
|
|
|
product_list: this.pos.db.get_product_by_category(0) |
|
|
|
}); |
|
|
|
this.product_list_widget.replace(this.$('.placeholder-ProductListWidget')); |
|
|
|
|
|
|
|
this.product_categories_widget = new screens.ProductCategoriesWidget(this,{ |
|
|
|
product_list_widget: this.product_list_widget, |
|
|
|
}); |
|
|
|
this.product_categories_widget.replace(this.$('.placeholder-ProductCategoriesWidget')); |
|
|
|
|
|
|
|
this.action_buttons = {}; |
|
|
|
var classes = action_button_classes; |
|
|
|
for (var i = 0; i < classes.length; i++) { |
|
|
|
var classe = classes[i]; |
|
|
|
if ( !classe.condition || classe.condition.call(this) ) { |
|
|
|
var widget = new classe.widget(this,{}); |
|
|
|
widget.appendTo(this.$('.control-buttons')); |
|
|
|
this.action_buttons[classe.name] = widget; |
|
|
|
} |
|
|
|
} |
|
|
|
if (_.size(this.action_buttons)) { |
|
|
|
this.$('.control-buttons').removeClass('oe_hidden'); |
|
|
|
} |
|
|
|
if (this.pos.config.balance_id) { |
|
|
|
|
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
|
|
|
|
scale_screen.$el.removeClass('oe_hidden'); |
|
|
|
|
|
|
|
this.product_categories_widget.reset_category(); |
|
|
|
this.numpad.state.reset(); |
|
|
|
|
|
|
|
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'); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
hide: function(){ |
|
|
|
this._super(); |
|
|
|
$("#pos-header-text-prod").addClass('oe_hidden'); |
|
|
|
|
|
|
|
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);
|
|
|
|
// },
|
|
|
|
|
|
|
|
click_product: function(product) { |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
|
|
|
|
if (scale_screen.weight != 0) { |
|
|
|
this.create_transaction(product); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
show: function(reset){ |
|
|
|
this._super(); |
|
|
|
if (reset) { |
|
|
|
this.product_categories_widget.reset_category(); |
|
|
|
this.numpad.state.reset(); |
|
|
|
} |
|
|
|
if (this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard) { |
|
|
|
this.chrome.widget.keyboard.connect($(this.el.querySelector('.searchbox input'))); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
create_transaction: function(product){ |
|
|
|
var self = this; |
|
|
|
var fields = {}; |
|
|
|
|
|
|
|
var container = this.gui.get_current_screen_param('container'); |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
|
|
|
|
var qrcode = ''; |
|
|
|
var ean13 = ''; |
|
|
|
var ean13_verif = ''; |
|
|
|
fields['qrcode'] = qrcode.concat('https://qr.mayam.fr/', container.barcode); |
|
|
|
fields['container_ean13'] = container.barcode; |
|
|
|
|
|
|
|
fields['product_id'] = product.id; |
|
|
|
// var product_id = (this.get_product().id).toString();
|
|
|
|
var product_id = ("00000" + product.default_code.toString()).slice(-5); |
|
|
|
|
|
|
|
var weight_str = (scale_screen.weight * 1000).toString(); |
|
|
|
weight_str = ("00000" + weight_str).slice(-5); |
|
|
|
|
|
|
|
ean13 = ean13.concat(26,product_id,weight_str,4); |
|
|
|
|
|
|
|
var weight_brut_str = (scale_screen.weight_brut * 1000).toString(); |
|
|
|
weight_brut_str = ("00000" + weight_brut_str).slice(-5); |
|
|
|
|
|
|
|
ean13_verif = ean13_verif.concat(26,'00999',weight_brut_str,4); |
|
|
|
|
|
|
|
var ean13_digit = this.pos.barcode_reader.barcode_parser.sanitize_ean(ean13); |
|
|
|
var ean13_verif_digit = this.pos.barcode_reader.barcode_parser.sanitize_ean(ean13_verif); |
|
|
|
|
|
|
|
fields['ean13'] = ean13_digit; |
|
|
|
fields['ean13_verif'] = ean13_verif_digit; |
|
|
|
fields['balance_id'] = this.pos.get_balance_id(); |
|
|
|
var today = new Date(); |
|
|
|
var date = today.getFullYear() + '-' + (today.getMonth()+1) + '-' + today.getDate(); |
|
|
|
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); |
|
|
|
var date_time = date + ' ' + time; |
|
|
|
fields['write_date'] = date_time; |
|
|
|
|
|
|
|
fields['weight_net'] = scale_screen.weight; |
|
|
|
fields['weight_tare'] = container.weight; |
|
|
|
|
|
|
|
var pricelist = scale_screen._get_active_pricelist(); |
|
|
|
fields['price_product'] = (product ? product.get_price(pricelist, scale_screen.weight) : 0) || 0; |
|
|
|
|
|
|
|
fields['price_net'] = fields['weight_net'] * fields['price_product']; |
|
|
|
|
|
|
|
fields.name = product.display_name; |
|
|
|
|
|
|
|
this.pos.push_transaction(fields).then( |
|
|
|
this.pushed_transaction(fields["ean13"], product, container) |
|
|
|
); |
|
|
|
}, |
|
|
|
|
|
|
|
pushed_transaction: function(barcode, product, container){ |
|
|
|
var self = this; |
|
|
|
|
|
|
|
this.gui.show_screen('confirmation',{product: product, container: container}); |
|
|
|
}, |
|
|
|
|
|
|
|
close: function(){ |
|
|
|
this._super(); |
|
|
|
if(this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard){ |
|
|
|
this.chrome.widget.keyboard.hide(); |
|
|
|
} |
|
|
|
this.pos.proxy_queue.clear(); |
|
|
|
}, |
|
|
|
}); |
|
|
|
gui.define_screen({name:'products-balance', widget: ProductBalanceScreenWidget}); |
|
|
|
|
|
|
|
/*--------------------------------------*\ |
|
|
|
| THE SCALE SCREEN FREE | |
|
|
|
| BALANCE CONTAINER | |
|
|
@ -434,6 +667,8 @@ 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(); |
|
|
@ -468,6 +703,10 @@ 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(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -541,7 +780,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
// The initial screen that allows you to scan container
|
|
|
|
var PresentationScreenWidget = screens.ScreenWidget.extend({ |
|
|
|
template: 'PresentationScreenWidget', |
|
|
|
next_screen: 'products', |
|
|
|
next_screen: 'products-balance', |
|
|
|
|
|
|
|
// Ignore products, discounts, and client barcodes
|
|
|
|
// barcode_product_action: function(code){},
|
|
|
@ -559,22 +798,25 @@ 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']; |
|
|
|
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(); |
|
|
|
var screen = this.gui.screen_instances['products']; |
|
|
|
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'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
@ -699,9 +941,11 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
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); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
@ -710,10 +954,14 @@ 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; |
|
|
@ -728,182 +976,6 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
screens.ProductScreenWidget.include({ |
|
|
|
|
|
|
|
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.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._super(); |
|
|
|
var self = this; |
|
|
|
|
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
|
|
|
|
scale_screen.$el.removeClass('oe_hidden'); |
|
|
|
|
|
|
|
this.product_categories_widget.reset_category(); |
|
|
|
this.numpad.state.reset(); |
|
|
|
|
|
|
|
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'); |
|
|
|
}, |
|
|
|
|
|
|
|
hide: function(){ |
|
|
|
this._super(); |
|
|
|
$("#pos-header-text-prod").addClass('oe_hidden'); |
|
|
|
|
|
|
|
var screen = this.gui.screen_instances['products']; |
|
|
|
}, |
|
|
|
|
|
|
|
// Ajout fonction scale
|
|
|
|
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); |
|
|
|
}, |
|
|
|
|
|
|
|
click_product: function(product) { |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
|
|
|
|
if (scale_screen.weight != 0) { |
|
|
|
this.create_transaction(product); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
create_transaction: function(product){ |
|
|
|
var self = this; |
|
|
|
var fields = {}; |
|
|
|
|
|
|
|
var container = this.gui.get_current_screen_param('container'); |
|
|
|
var scale_screen = this.gui.screen_instances['balancescale']; |
|
|
|
|
|
|
|
var qrcode = ''; |
|
|
|
var ean13 = ''; |
|
|
|
var ean13_verif = ''; |
|
|
|
fields['qrcode'] = qrcode.concat('https://qr.mayam.fr/', container.barcode); |
|
|
|
fields['container_ean13'] = container.barcode; |
|
|
|
|
|
|
|
fields['product_id'] = product.id; |
|
|
|
// var product_id = (this.get_product().id).toString();
|
|
|
|
var product_id = ("00000" + product.default_code.toString()).slice(-5); |
|
|
|
|
|
|
|
var weight_str = (scale_screen.weight * 1000).toString(); |
|
|
|
weight_str = ("00000" + weight_str).slice(-5); |
|
|
|
|
|
|
|
ean13 = ean13.concat(26,product_id,weight_str,4); |
|
|
|
|
|
|
|
var weight_brut_str = (scale_screen.weight_brut * 1000).toString(); |
|
|
|
weight_brut_str = ("00000" + weight_brut_str).slice(-5); |
|
|
|
|
|
|
|
ean13_verif = ean13_verif.concat(26,'00999',weight_brut_str,4); |
|
|
|
|
|
|
|
var ean13_digit = this.pos.barcode_reader.barcode_parser.sanitize_ean(ean13); |
|
|
|
var ean13_verif_digit = this.pos.barcode_reader.barcode_parser.sanitize_ean(ean13_verif); |
|
|
|
|
|
|
|
fields['ean13'] = ean13_digit; |
|
|
|
fields['ean13_verif'] = ean13_verif_digit; |
|
|
|
fields['balance_id'] = this.pos.get_balance_id(); |
|
|
|
var today = new Date(); |
|
|
|
var date = today.getFullYear() + '-' + (today.getMonth()+1) + '-' + today.getDate(); |
|
|
|
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds(); |
|
|
|
var date_time = date + ' ' + time; |
|
|
|
fields['write_date'] = date_time; |
|
|
|
|
|
|
|
fields['weight_net'] = scale_screen.weight; |
|
|
|
fields['weight_tare'] = container.weight; |
|
|
|
|
|
|
|
var pricelist = scale_screen._get_active_pricelist(); |
|
|
|
fields['price_product'] = (product ? product.get_price(pricelist, scale_screen.weight) : 0) || 0; |
|
|
|
|
|
|
|
fields['price_net'] = fields['weight_net'] * fields['price_product']; |
|
|
|
|
|
|
|
fields.name = product.display_name; |
|
|
|
|
|
|
|
this.pos.push_transaction(fields).then( |
|
|
|
this.pushed_transaction(fields["ean13"], product, container) |
|
|
|
); |
|
|
|
}, |
|
|
|
|
|
|
|
pushed_transaction: function(barcode, product, container){ |
|
|
|
var self = this; |
|
|
|
|
|
|
|
this.gui.show_screen('confirmation',{product: product, container: container}); |
|
|
|
}, |
|
|
|
|
|
|
|
close: function(){ |
|
|
|
this._super(); |
|
|
|
|
|
|
|
this.pos.proxy_queue.clear(); |
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
var CheckBarcodePopupDoublon = popups.extend({ |
|
|
|
|
|
|
|
template:'CheckBarcodePopupDoublon', |
|
|
@ -927,6 +999,7 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require) |
|
|
|
gui.define_popup({name:'doublon-barcode', widget: CheckBarcodePopupDoublon}); |
|
|
|
|
|
|
|
return { |
|
|
|
ProductBalanceScreenWidget: ProductBalanceScreenWidget, |
|
|
|
BalanceContainerScaleScreenWidget: BalanceContainerScaleScreenWidget, |
|
|
|
PresentationScreenWidget: PresentationScreenWidget, |
|
|
|
BalanceScaleScreenWidget: BalanceScaleScreenWidget, |
|
|
|