[IMP] point_of_sale: indicate on pos picking type the use of lots

By unticking the "Use Existing Lots" checkbox on the pos picking type,
you can choose not to enter any lots/serial numbers in the pos.  This
way, the picking will not specify the lots either and the system will
take the quants and lots according to the removal strategy.
This commit is contained in:
Josse Colpaert
2017-04-12 15:40:40 +02:00
parent 283f8df95b
commit d5908083b4
3 changed files with 8 additions and 3 deletions
@@ -62,6 +62,7 @@ class PosConfig(models.Model):
'pos_config_id', 'journal_id', string='Available Payment Methods',
domain="[('journal_user', '=', True ), ('type', 'in', ['bank', 'cash'])]",)
picking_type_id = fields.Many2one('stock.picking.type', string='Operation Type')
use_existing_lots = fields.Boolean(related='picking_type_id.use_existing_lots')
stock_location_id = fields.Many2one(
'stock.location', string='Stock Location',
domain=[('usage', '=', 'internal')], required=True, default=_get_default_location)
+6 -2
View File
@@ -643,13 +643,17 @@ class PosOrder(models.Model):
has_wrong_lots = False
for order in self:
for pack_operation in (picking or self.picking_id).pack_operation_ids:
picking_type = (picking or self.picking_id).picking_type_id
lots_necessary = True
if picking_type:
lots_necessary = picking_type and picking_type.use_existing_lots
qty = 0
qty_done = 0
pack_lots = []
pos_pack_lots = PosPackOperationLot.search([('order_id', '=', order.id), ('product_id', '=', pack_operation.product_id.id)])
pack_lot_names = [pos_pack.lot_name for pos_pack in pos_pack_lots]
if pack_lot_names:
if pack_lot_names and lots_necessary:
for lot_name in list(set(pack_lot_names)):
stock_production_lot = StockProductionLot.search([('name', '=', lot_name), ('product_id', '=', pack_operation.product_id.id)])
if stock_production_lot:
@@ -662,7 +666,7 @@ class PosOrder(models.Model):
pack_lots.append({'lot_id': stock_production_lot.id, 'qty': qty})
else:
has_wrong_lots = True
elif pack_operation.product_id.tracking == 'none':
elif pack_operation.product_id.tracking == 'none' or not lots_necessary:
qty_done = pack_operation.product_qty
else:
has_wrong_lots = True
+1 -1
View File
@@ -1219,7 +1219,7 @@ exports.Orderline = Backbone.Model.extend({
return orderline;
},
set_product_lot: function(product){
this.has_product_lot = product.tracking !== 'none';
this.has_product_lot = product.tracking !== 'none' && this.pos.config.use_existing_lots;
this.pack_lot_lines = this.has_product_lot && new PacklotlineCollection(null, {'order_line': this});
},
// sets a discount [0,100]%