Jignesh Rathod(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-945213-jir into 
lp:openobject-addons.

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

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-945213-jir/+merge/102484

Hello ,

Fixes the problem of constraint message.

Thank you.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-945213-jir/+merge/102484
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-945213-jir.
=== modified file 'stock/stock.py'
--- stock/stock.py	2012-04-03 13:52:37 +0000
+++ stock/stock.py	2012-04-18 10:25:25 +0000
@@ -1593,6 +1593,14 @@
                 return False
         return True
 
+    def _construct_constraint_msg(self, cr, uid, ids, context=None):
+        """ Return Constraint Message 
+        """
+        for move in self.browse(cr, uid, ids, context=context):
+            if move.prodlot_id and move.state == 'done' and (move.prodlot_id.product_id.id != move.product_id.id):
+                return 'You try to assign a lot which is not from the same product : '+ move.product_id.name
+        return True
+
     def _check_product_lot(self, cr, uid, ids, context=None):
         """ Checks whether move is done or not and production lot is assigned to that move.
         @return: True or False
@@ -1654,9 +1662,7 @@
             ['prodlot_id']),
         (_check_location, 'You can not move products from or to a location of the type view.',
             ['location_id','location_dest_id']),
-        (_check_product_lot,
-            'You try to assign a lot which is not from the same product',
-            ['prodlot_id'])]
+        (_check_product_lot, _construct_constraint_msg,['prodlot_id'])]
 
     def _default_location_destination(self, cr, uid, context=None):
         """ Gets default address of partner for destination location

_______________________________________________
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