Amit Parik (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1033687-amp into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1033687 in OpenERP Addons: "stock. userfriendly error messages"
  https://bugs.launchpad.net/openobject-addons/+bug/1033687

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1033687-amp/+merge/118477

Hello,

Improved the _check_location constraint, it will show the product name as well 
as location name.

Thank you! 
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1033687-amp/+merge/118477
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1033687-amp.
=== modified file 'stock/stock.py'
--- stock/stock.py	2012-08-06 11:00:35 +0000
+++ stock/stock.py	2012-08-07 06:14:22 +0000
@@ -1656,7 +1656,10 @@
     }
     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
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to