From: Frédéric van der Essen Date: Tue, 11 Feb 2014 16:45:41 +0000 (+0100) Subject: [IMP] point_of_sale: allow negative product quantities, and negatives totals X-Git-Tag: InsPy_master01~565^2~1 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=bcc6a6aeda2dd9dde545d5064c6a85180cdd8e80;p=odoo%2Fodoo.git [IMP] point_of_sale: allow negative product quantities, and negatives totals bzr revid: fva@openerp.com-20140211164541-nt2xu5rhdv0tm7pk --- diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 6b54c14..2197783 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -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')); }, diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index cbd6779..937ee3f 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -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) {