[FIX] stock : Fix the usebility improvement on check location constraint

lp bug: https://launchpad.net/bugs/1033687 fixed

bzr revid: amp@tinyerp.com-20120807061011-txpon5iw3y73rsa3
This commit is contained in:
Ferdinand 2012-08-07 11:40:11 +05:30 committed by Amit (OpenERP)
parent 3cfd65b43d
commit 0caaa1687b
1 changed files with 4 additions and 1 deletions

View File

@ -1656,7 +1656,10 @@ class stock_move(osv.osv):
}
def _check_location(self, cr, uid, ids, context=None):
for record in self.browse(cr, uid, ids, context=context):
if (record.state=='done') and (record.location_dest_id.usage == 'view' or record.location_id.usage == 'view'):
if (record.state=='done') and (record.location_id.usage == 'view'):
raise osv.except_osv(_('Error'), _('You can not move product %s from location of type view %s ')% (record.product_id.name, record.location_id.name))
if (record.state=='done') and (record.location_dest_id.usage == 'view' ):
raise osv.except_osv(_('Error'), _('You can not move product %s to location of type view %s ')% (record.product_id.name, record.location_dest_id.name))
return False
return True