[FIX] Import : multiple O2M import corrected
authorJay (OpenERP) <jvo@tinyerp.com>
Wed, 29 Sep 2010 12:04:03 +0000 (17:34 +0530)
committerJay (OpenERP) <jvo@tinyerp.com>
Wed, 29 Sep 2010 12:04:03 +0000 (17:34 +0530)
bzr revid: jvo@tinyerp.com-20100929120403-ve1b9lrmkhq9i8n3

bin/osv/orm.py

index 7692d1c..3d3d11e 100644 (file)
@@ -818,7 +818,7 @@ class orm_template(object):
                 nbrmax = max(nbrmax, max2)
                 warning = warning + w2         
                 reduce(lambda x, y: x and y, newrow)       
-                row[field] = (reduce(lambda x, y: x or y, newrow.values()) and \
+                row[field] = newrow and (reduce(lambda x, y: x or y, newrow.values()) and \
                         [(0, 0, newrow)]) or []                
                 i = max2
                 while (position+i)<len(datas):
@@ -833,7 +833,7 @@ class orm_template(object):
                     (newrow, max2, w2, translate2, data_id2, data_res_id2) = process_liness(
                             self, datas, prefix+[field], current_module, relation_obj._name, newfd, position+i)
                     warning = warning+w2
-                    if reduce(lambda x, y: x or y, newrow.values()):
+                    if newrow and reduce(lambda x, y: x or y, newrow.values()):
                         row[field].append((0, 0, newrow))                    
                     i += max2
                     nbrmax = max(nbrmax, i)