Browse Source

Remise en place du POS

12-V2.0
Juliana 3 years ago
parent
commit
0340cfbe41
  1. 22
      static/src/css/style.css
  2. 729
      static/src/js/container.js
  3. 50
      static/src/xml/pos.xml

22
static/src/css/style.css

@ -17,7 +17,9 @@
margin-top: 65px;
}
.pos .pos-topheader{
.pos .presentation-screen .pos-topheader,
.pos .product-balance-screen .pos-topheader,
.pos .confirmation-screen .pos-topheader{
height: auto !important;
background-color: #f1eeef;
z-index: 100;
@ -76,13 +78,13 @@
}
.pos .leftpane .btn-container {
/*.pos .leftpane .btn-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 300px;
border-top: solid 3px rgb(110, 200, 155);
}
}*/
.pos .scale-screen, .pos .balancecontainerscale-screen{
position: fixed;
@ -170,12 +172,12 @@
padding: 30px 0px;
}
.pos .rightpane{
.pos .product-balance-screen .rightpane{
left: 0;
top: 45px;
}
.pos .product-screen .leftpane{
.pos .product-balance-screen .leftpane{
display: none;
}
@ -284,12 +286,6 @@ h1.product-name {
.screen .rightpane .top-content {
position: relative;
}
/*
.pos-bottom {
width: 100%;
position: absolute;
bottom: 0;
}*/
.centered-content-flex {
font-size: 22px;
@ -358,7 +354,7 @@ h1.product-name {
border-bottom: none;
}
.screen .top-content .button{
.screen .pos-topheader-scale-cont .top-content .button{
position: relative;
}
@ -384,6 +380,6 @@ h1.product-name {
.searchbox{
display: none;
}*/
.pos .product-list-scroller{
.pos .product-balance-screen .product-list-scroller{
padding-bottom: 200px;
}

729
static/src/js/container.js

@ -24,44 +24,31 @@ 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;
var queue = this.pos.proxy_queue;
if (this.pos.config.balance_id) {
var queue = this.pos.proxy_queue;
var container = this.gui.get_current_screen_param('container');
var container = this.gui.get_current_screen_param('container');
// format price
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);
// 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});
// }
// format price
var scale_screen = this.gui.screen_instances['balancescale'];
var price = scale_screen.format_price(scale_screen.get_product_price());
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();
@ -74,48 +61,61 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
},
set_weight: function(weight){
var scale_screen = this.gui.screen_instances['balancescale'];
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('0.000 kg');
var container_text = '0.000 kg'
scale_screen.$('.tare-container').text(container_text);
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());
scale_screen.$('.computed-price').text(scale_screen.format_currency(scale_screen.get_product_price() * 0));
scale_screen.$('.weight-brut').text('0.000 kg');
var container_text = '0.000 kg'
scale_screen.$('.tare-container').text(container_text);
}
else {
this._super();
}
},
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));
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();
var container = selected_orderline.get_container();
// Vérfification: est-ce qu'un container vient d'être utilisé dans l'heure
if (self.pos.scan_container_check(code)){
var transaction = self.pos.scan_container_check(code);
this.gui.show_popup('doublon-barcode',{
title: _t('Contenu déjà enregistré récemment:'),
transaction: transaction,
confirm: function(){
var transaction = self.pos.scan_container_check(code)
self.delete_selected_transaction(transaction, code);
self.gui.show_screen('products-balance', {container: container});
},
});
if (self.pos.scan_container(code)) {
var order = this.pos.get_order();
var selected_orderline = order.get_selected_orderline();
var container = selected_orderline.get_container();
// Vérfification: est-ce qu'un container vient d'être utilisé dans l'heure
if (self.pos.scan_container_check(code)){
var transaction = self.pos.scan_container_check(code);
this.gui.show_popup('doublon-barcode',{
title: _t('Contenu déjà enregistré récemment:'),
transaction: transaction,
confirm: function(){
var transaction = self.pos.scan_container_check(code)
self.delete_selected_transaction(transaction, code);
self.gui.show_screen('products', {container: container});
},
});
} else {
self.gui.show_screen('products-balance', {container: container});
}
} else {
self.gui.show_screen('products', {container: container});
self.gui.show_screen('balancecontainerscale', {barcode: code.base_code});
}
} else {
self.gui.show_screen('balancecontainerscale', {barcode: code.base_code});
this._super();
}
},
@ -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,61 +185,66 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
show: function(){
var self = this;
var queue = this.pos.proxy_queue;
this.set_weight(0);
this.renderElement();
var container = this.gui.get_current_screen_param('container');
if (this.pos.config.balance_id) {
var queue = this.pos.proxy_queue;
queue.schedule(function () {
return self.pos.proxy.reset_weight().then(function () {
self.set_weight(0);
self.set_price(0);
});
}, {duration: 500});
this.set_weight(0);
this.renderElement();
// format price
var price = this.format_price(this.get_product_price());
var container = this.gui.get_current_screen_param('container');
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();
}
return self.pos.proxy.reset_weight().then(function () {
self.set_weight(0);
self.set_price(0);
});
}, {duration: 500, repeat: true});
}, {duration: 500});
// format 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);
self.create_transaction();
self.order_product();
}
});
}, {duration: 500, repeat: true});
}
// this._super();
var self = this;
this.$('.next,.add-transaction').click(function(){
self.create_transaction();
});
$("#pos-header-text-peser").removeClass('oe_hidden');
} 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);
self.create_transaction();
self.order_product();
}
});
}, {duration: 500, repeat: true});
this._super();
}
// this._super();
var self = this;
this.$('.next,.add-transaction').click(function(){
self.create_transaction();
});
$("#pos-header-text-peser").removeClass('oe_hidden');
},
@ -411,7 +416,235 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
widget: BalanceScaleScreenWidget,
});
/* -------- 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,40 +667,46 @@ odoo.define('vracoop_pos_free_balance_v2.container_balance', function (require)
show: function(){
var self = this;
var queue = this.pos.proxy_queue;
var priceStr = '001000'; // bizerba doesn't accept '000000' as unit price
this.renderElement();
queue.schedule(function () {
return self.pos.proxy.reset_weight().then(function () {
self.set_weight(0);
});
}, {duration: 500});
if (this.pos.config.balance_id) {
queue.schedule(function () {
return self.pos.proxy.scale_read_data_price(priceStr).then(function (scale_answer) {
self.set_weight(scale_answer.weight);
if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) {
self.gui.show_screen(self.next_screen);
if (self.pos.config.is_comptoir) {
self.create_container();
var queue = this.pos.proxy_queue;
var priceStr = '001000'; // bizerba doesn't accept '000000' as unit price
this.renderElement();
queue.schedule(function () {
return self.pos.proxy.reset_weight().then(function () {
self.set_weight(0);
});
}, {duration: 500});
queue.schedule(function () {
return self.pos.proxy.scale_read_data_price(priceStr).then(function (scale_answer) {
self.set_weight(scale_answer.weight);
if ((scale_answer.error === '30' || scale_answer.error === '31') && scale_answer.weight !== 0) {
self.gui.show_screen(self.next_screen);
if (self.pos.config.is_comptoir) {
self.create_container();
}
}
}
});
}, {duration: 500, repeat: true});
this._super();
});
}, {duration: 500, repeat: true});
this._super();
var self = this;
var self = this;
this.$('.next,.add-container').click(function(){
self.create_container();
});
this.$('.next,.add-container').click(function(){
self.create_container();
});
if(this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard){
this.chrome.widget.keyboard.connect($(this.el.querySelector('.container-name input')));
if(this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard){
this.chrome.widget.keyboard.connect($(this.el.querySelector('.container-name input')));
}
$("#pos-header-text-peser").removeClass('oe_hidden');
$("#pos-topheader-scale-cont").removeClass('oe_hidden');
} else {
this._super();
}
$("#pos-header-text-peser").removeClass('oe_hidden');
$("#pos-topheader-scale-cont").removeClass('oe_hidden');
},
@ -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;
var scale_screen = this.gui.screen_instances['balancescale'];
scale_screen.$el.removeClass('oe_hidden');
var screen = this.gui.screen_instances['products'];
screen.$el.removeClass('oe_hidden');
$("#pos-header-text-selec").removeClass('oe_hidden');
$("#pos-header-text-confirm").addClass('oe_hidden');
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();
var screen = this.gui.screen_instances['products'];
screen.$el.addClass('oe_hidden');
$("#pos-header-text-selec").addClass('oe_hidden');
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();
options = options || {};
this.close_popup();
this.show_screen(this.startup_screen);
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(){
this.$el.addClass('oe_invisible');
if (this.pos.config.balance_id) {
this.$el.addClass('oe_invisible');
}
},
show: function(){
this.$el.removeClass('oe_invisible');
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,

50
static/src/xml/pos.xml

@ -251,10 +251,10 @@
</t>
</t>
<t t-extend="ProductScreenWidget">
<t t-jquery='.leftpane' t-operation='before'>
<t t-name="ProductBalanceScreenWidget">
<div class="product-balance-screen screen">
<div class="pos-topheader">
<div class="pos-header-custo">
<div class="pos-header-custo">
<div class="">
<span class='button back'>
<i class='fa fa-angle-double-left'></i>
@ -270,6 +270,48 @@
</div>
</div>
</div>
</t>
<div class="leftpane">
<div class='window'>
<div class='subwindow'>
<div class='subwindow-container'>
<div class='subwindow-container-fix'>
<div class="placeholder-OrderWidget"></div>
</div>
</div>
</div>
<div class='subwindow collapsed'>
<div class='subwindow-container'>
<div class='subwindow-container-fix pads'>
<div class="control-buttons oe_hidden"></div>
<div class="placeholder-ActionpadWidget"></div>
<div class="placeholder-NumpadWidget"></div>
</div>
</div>
</div>
</div>
</div>
<div class="rightpane">
<table class="layout-table">
<tr class="header-row">
<td class="header-cell">
<span class="placeholder-ProductCategoriesWidget" />
</td>
</tr>
<tr class="content-row">
<td class="content-cell">
<div class="content-container">
<span class="placeholder-ProductListWidget" />
</div>
</td>
</tr>
</table>
</div>
</div>
</t>
</templates>
Loading…
Cancel
Save