[IMP] point_of_sale: allow negative product quantities, and negatives totals

bzr revid: fva@openerp.com-20140211164541-nt2xu5rhdv0tm7pk
This commit is contained in:
Frédéric van der Essen 2014-02-11 17:45:41 +01:00
parent 22e09cb41e
commit bcc6a6aeda
2 changed files with 7 additions and 6 deletions

View File

@ -544,11 +544,11 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
this.order.removeOrderline(this);
return;
}else{
var quant = Math.max(parseFloat(quantity) || 0, 0);
var quant = parseFloat(quantity) || 0;
var unit = this.get_unit();
if(unit){
this.quantity = Math.max(unit.rounding, round_pr(quant, unit.rounding));
this.quantityStr = this.quantity.toFixed(Math.max(0,Math.ceil(Math.log(1.0 / unit.rounding) / Math.log(10))));
this.quantity = round_pr(quant, unit.rounding);
this.quantityStr = this.quantity.toFixed(Math.ceil(Math.log(1.0 / unit.rounding) / Math.log(10)));
}else{
this.quantity = quant;
this.quantityStr = '' + this.quantity;
@ -1104,10 +1104,11 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
}
},
switchSign: function() {
console.log('switchsing');
var oldBuffer;
oldBuffer = this.get('buffer');
this.set({
buffer: oldBuffer[0] === '-' ? oldBuffer.substr(1) : "-" + oldBuffer
buffer: oldBuffer[0] === '-' ? oldBuffer.substr(1) : "-" + oldBuffer
});
this.trigger('set_value',this.get('buffer'));
},

View File

@ -1125,8 +1125,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
},
is_paid: function(){
var currentOrder = this.pos.get('selectedOrder');
return (currentOrder.getTotalTaxIncluded() >= 0.000001
&& currentOrder.getPaidTotal() + 0.000001 >= currentOrder.getTotalTaxIncluded());
return (currentOrder.getTotalTaxIncluded() < 0.000001
|| currentOrder.getPaidTotal() + 0.000001 >= currentOrder.getTotalTaxIncluded());
},
validate_order: function(options) {