diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index a72c87cef52..11263840180 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -654,7 +654,8 @@ class PosOrder(models.Model): stock_production_lot = StockProductionLot.search([('name', '=', lot_name), ('product_id', '=', pack_operation.product_id.id)]) if stock_production_lot: if stock_production_lot.product_id.tracking == 'lot': - qty = pack_lot_names.count(lot_name) + # if a lot nr is set through the frontend it will refer to the full quantity + qty = pack_operation.product_qty else: qty = 1.0 qty_done += qty diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 87ce0480022..bbc1c482e2a 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1282,16 +1282,28 @@ exports.Orderline = Backbone.Model.extend({ } }, + get_required_number_of_lots: function(){ + var lots_required = 1; + + if (this.product.tracking == 'serial') { + lots_required = this.quantity; + } + + return lots_required; + }, + compute_lot_lines: function(){ var pack_lot_lines = this.pack_lot_lines; var lines = pack_lot_lines.length; - if(this.quantity > lines){ - for(var i=0; i lines){ + for(var i=0; i