From c9d436f089a553edb142029fefd7f830ec7678ed Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 11 May 2011 12:27:46 +0530 Subject: [PATCH] [FIX]stock:put constrain for restric view type location as destination in picking lp bug: https://launchpad.net/bugs/780354 fixed bzr revid: ron@tinyerp.com-20110511065746-ioojaku0d2os8gpz --- addons/stock/stock.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 2d516f1a8a5..0985a74f92a 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -658,6 +658,19 @@ class stock_picking(osv.osv): 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c) } + + def _destination_location(self, cr, uid, ids, context=None): + if context is None: + context = {} + for record in self.browse(cr, uid, ids, context=context)[0].move_lines: + if record.location_dest_id.usage == 'view': + return False + return True + + _constraints = [ + (_destination_location, 'You cannot put view type location as Destination location.', ['location_dest_id']) + ] + def action_process(self, cr, uid, ids, context=None): if context is None: context = {} partial_id = self.pool.get("stock.partial.picking").create(