From c292e44d5ec6f0175e4c073da2d1387b1cc7d956 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 19 Jul 2017 14:30:15 +0200 Subject: [PATCH] [REM] stock: move: remove `restrict_lot_id` field Before, it was possible to have a move without move line / pack operations and the `restrict_lot_id` was used in this case. Now, every move has move lines / pack operations and this field was unused. Let's remove it. --- addons/stock/models/stock_inventory.py | 1 - addons/stock/models/stock_move.py | 6 ++---- addons/stock/models/stock_scrap.py | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index 6cd3821fb90..1378bcfde88 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -408,7 +408,6 @@ class InventoryLine(models.Model): 'company_id': self.inventory_id.company_id.id, 'inventory_id': self.inventory_id.id, 'state': 'confirmed', - #'restrict_lot_id': self.prod_lot_id.id, 'restrict_partner_id': self.partner_id.id, 'location_id': location_id, 'location_dest_id': location_dest_id, diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index d5633a7889c..df7cc8aec52 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -144,7 +144,6 @@ class StockMove(models.Model): string_availability_info = fields.Text( 'Availability', compute='_compute_string_qty_information', readonly=True, help='Show various information on stock availability for this move') - restrict_lot_id = fields.Many2one('stock.production.lot', 'Lot/Serial Number', help="Technical field used to depict a restriction on the lot/serial number of quants to consider when marking this move as 'done'") restrict_partner_id = fields.Many2one('res.partner', 'Owner ', help="Technical field used to depict a restriction on the ownership of quants to consider when marking this move as 'done'") route_ids = fields.Many2many('stock.location.route', 'stock_location_route_move', 'move_id', 'route_id', 'Destination route', help="Preferred route to be followed by the procurement order") warehouse_id = fields.Many2one('stock.warehouse', 'Warehouse', help="Technical field depicting the warehouse to consider for the route selection on the next procurement (if any).") @@ -647,7 +646,7 @@ class StockMove(models.Model): if move.picking_id and \ (move.picking_id.picking_type_id.use_existing_lots or move.picking_id.picking_type_id.use_create_lots) and \ move.product_id.tracking != 'none' and \ - not (move.restrict_lot_id or (move_line and (move_line.product_id and move_line.pack_lot_ids)) or (move_line and not move_line.product_id)): + not (move_line and (move_line.product_id and move_line.pack_lot_ids)) or (move_line and not move_line.product_id): raise UserError(_('You need to provide a Lot/Serial Number for product %s') % move.product_id.name) def _prepare_move_line_vals(self, quantity=None, reserved_quant=None): @@ -932,11 +931,10 @@ class StockMove(models.Model): return vals @api.multi - def split(self, qty, restrict_lot_id=False, restrict_partner_id=False): + def split(self, qty, restrict_partner_id=False): """ Splits qty from move move into a new move :param qty: float. quantity to split (given in product UoM) - :param restrict_lot_id: optional production lot that can be given in order to force the new move to restrict its choice of quants to this lot. :param restrict_partner_id: optional partner that can be given in order to force the new move to restrict its choice of quants to the ones belonging to this partner. :param context: dictionay. can contains the special key 'source_location_id' in order to force the source location when copying the move :returns: id of the backorder move created """ diff --git a/addons/stock/models/stock_scrap.py b/addons/stock/models/stock_scrap.py index 3d3f8eb9116..4e0cad94729 100644 --- a/addons/stock/models/stock_scrap.py +++ b/addons/stock/models/stock_scrap.py @@ -109,7 +109,6 @@ class StockScrap(models.Model): 'package_id': self.package_id.id, 'owner_id': self.owner_id.id, 'lot_id': self.lot_id.id, })], -# 'restrict_lot_id': self.lot_id.id, # FIXME: JCO i asked you x times, should we drop this or not???? # 'restrict_partner_id': self.owner_id.id, 'picking_id': self.picking_id.id }