From: Mohammad Alhashash Date: Tue, 11 Nov 2014 12:48:48 +0000 (+0200) Subject: [FIX] stock: prevent serial number deletion on stock.move X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=2461baa0dda461792d5c3f5a72cb8a98bc3877a1;p=odoo%2Fodoo.git [FIX] stock: prevent serial number deletion on stock.move prodlot_id field may be required due to constraint `_check_tracking`. When a stock.production.lot is deleted, the constraint on linked stock.move is not checked. To avoid inconsistency, restrict the suppression. To allow the modification of existing stock.move, remove the states attribute on the field definition. As removal of serial may impact the traceability, it makes sense on buisness point of view to force the modification of previous stock.move, even if the constraint would not have been violated. The list of linked stock.move is present on the serial form view making the operation easier. Fixes #3560, lp:1176912 --- diff --git a/addons/stock/stock.py b/addons/stock/stock.py index bd15c45..7dc39c1 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1641,7 +1641,7 @@ class stock_move(osv.osv): 'location_dest_id': fields.many2one('stock.location', 'Destination Location', required=True,states={'done': [('readonly', True)]}, select=True, help="Location where the system will stock the finished products."), 'partner_id': fields.many2one('res.partner', 'Destination Address ', states={'done': [('readonly', True)]}, help="Optional address where goods are to be delivered, specifically used for allotment"), - 'prodlot_id': fields.many2one('stock.production.lot', 'Serial Number', states={'done': [('readonly', True)]}, help="Serial number is used to put a serial number on the production", select=True), + 'prodlot_id': fields.many2one('stock.production.lot', 'Serial Number', help="Serial number is used to put a serial number on the production", select=True, ondelete='restrict'), 'tracking_id': fields.many2one('stock.tracking', 'Pack', select=True, states={'done': [('readonly', True)]}, help="Logistical shipping unit: pallet, box, pack ..."), 'auto_validate': fields.boolean('Auto Validate'),