diff options
| author | Pierre Masereel <pim@odoo.com> | 2020-12-16 13:42:09 +0000 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2020-12-17 10:42:10 +0000 |
| commit | b6b5e7c148f2b7b44830022325aa9010a4c683ba (patch) | |
| tree | 75ff5df1cc5b4fce88c07829829c9b578c0ca082 /addons/point_of_sale/static/src/js/models.js | |
| parent | 943af890ee5f297d9509c12aba291bdc729f8c20 (diff) | |
[FIX] point_of_sale: having negative value with decrease quantity
When you have a localisation like the french one that does not allow
you to decrease the value of a line, you cannot make returns because the
popup that shows you new value to encode, does not let you enter
negative numbers.
To allow those negative values, we let the modification of the line if
we are on the last line, and the quantity is equal to 1 which is the
default value of the line. It is the same behavior as in 13.0.
OPW-2411356
closes odoo/odoo#63451
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/point_of_sale/static/src/js/models.js')
| -rw-r--r-- | addons/point_of_sale/static/src/js/models.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index d925041dd5f..3a4794516db 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -2339,6 +2339,13 @@ exports.Orderline = Backbone.Model.extend({ this.product.lst_price = round_di(parseFloat(price) || 0, this.pos.dp['Product Price']); this.trigger('change',this); }, + is_last_line: function() { + var order = this.pos.get_order(); + var last_id = Object.keys(order.orderlines._byId)[Object.keys(order.orderlines._byId).length-1]; + var selectedLine = order? order.selected_orderline: null; + + return !selectedLine ? false : last_id === selectedLine.cid; + }, }); var OrderlineCollection = Backbone.Collection.extend({ |
