[FIX] M2M : values filtering on set()
authorJay (Open ERP) <jvo@tinyerp.com>
Wed, 11 Nov 2009 05:50:28 +0000 (11:20 +0530)
committerJay (Open ERP) <jvo@tinyerp.com>
Wed, 11 Nov 2009 05:50:28 +0000 (11:20 +0530)
lp bug: https://launchpad.net/bugs/480301 fixed

bzr revid: jvo@tinyerp.com-20091111055028-lza87cnyffvwxy4i

bin/osv/fields.py

index cde2a0e..dc5e2a9 100644 (file)
@@ -528,6 +528,8 @@ class many2many(_column):
             return
         obj = obj.pool.get(self._obj)
         for act in values:
+            if not (isinstance(act, list) or isinstance(act, tuple)) or not act:
+                continue
             if act[0] == 0:
                 idnew = obj.create(cr, user, act[2])
                 cr.execute('insert into '+self._rel+' ('+self._id1+','+self._id2+') values (%s,%s)', (id, idnew))