[MERGE] point_of_sale: fixing bugs discovered during the opendays

bzr revid: fva@openerp.com-20130708150246-s2u2meqtboyv139h
This commit is contained in:
Frédéric van der Essen 2013-07-08 17:02:46 +02:00
commit 638f0f5fa3
5 changed files with 21 additions and 23 deletions

View File

@ -290,7 +290,7 @@
<record id="peche" model="product.product">
<field name="available_in_pos">True</field>
<field name="list_price">5.10</field>
<field name="name">Fishing</field>
<field name="name">Peaches</field>
<field name="to_weight">True</field>
<field name="ean13">2300001000008</field>
<field name="pos_categ_id" ref="rouges_noyau_fruits"/>

View File

@ -12,6 +12,8 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
this.weight = 0;
this.weighting = false;
this.debug_weight = 0;
this.use_debug_weight = false;
this.paying = false;
this.default_payment_status = {
@ -92,38 +94,36 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal
// and a weighting_end()
weighting_read_kg: function(){
var self = this;
if(this.bypass_proxy){
return this.weight;
}else{
this.message('weighting_read_kg',{})
.done(function(weight){
if(self.weighting && !self.bypass_proxy){
this.message('weighting_read_kg',{})
.done(function(weight){
if(self.weighting){
if(self.use_debug_weight){
self.weight = self.debug_weight;
}else{
self.weight = weight;
}
});
return this.weight;
}
}
});
return this.weight;
},
// sets a custom weight, ignoring the proxy returned value.
debug_set_weight: function(kg){
this.bypass_proxy = true;
this.weight = kg;
this.use_debug_weight = true;
this.debug_weight = kg;
},
// resets the custom weight and re-enable listening to the proxy for weight values
debug_reset_weight: function(){
this.bypass_proxy = false;
this.weight = 0;
this.use_debug_weight = false;
this.debug_weight = 0;
},
// the client has finished weighting products
weighting_end: function(){
if(!this.bypass_proxy){
this.weight = 0;
this.weighting = false;
this.message('weighting_end');
}
this.weight = 0;
this.weighting = false;
this.message('weighting_end');
},
// the pos asks the client to pay 'price' units

View File

@ -104,7 +104,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
return self.fetch('res.currency',['symbol','position','rounding','accuracy'],[['id','=',self.get('company').currency_id[0]]]);
}).then(function(currencies){
console.log('Currency:',currencies[0]);
self.set('currency',currencies[0]);
return self.fetch('product.uom', null, null);
@ -234,8 +233,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
on_removed_order: function(removed_order){
if( this.get('orders').isEmpty()){
this.add_new_order();
}
if( this.get('selectedOrder') === removed_order){
}else{
this.set({ selectedOrder: this.get('orders').last() });
}
},

View File

@ -459,7 +459,6 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
click: function(){
clearInterval(this.intervalID);
self.pos.proxy.weighting_end();
self.pos_widget.screen_selector.set_current_screen(self.previous_screen);
}
});

View File

@ -743,6 +743,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
}
});
this.$('.button.reset_weight').click(function(){
self.$('input.weight').val('');
self.pos.proxy.debug_reset_weight();
});
this.$('.button.custom_ean').click(function(){