From 9f542c792a563e4521eec91dacbef7aeb62a6ff9 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Sun, 12 Apr 2009 16:42:39 +0300 Subject: [PATCH] Fix copying of one2many, one2one empty fields. bzr revid: p_christ@hol.gr-20090412134239-d487cn2q47u4wrmi --- bin/osv/orm.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index e9dfb83e118..1e03d3078b4 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -2690,13 +2690,14 @@ class orm(orm_template): elif ftype in ('one2many', 'one2one'): res = [] rel = self.pool.get(fields[f]['relation']) - for rel_id in data[f]: - # the lines are first duplicated using the wrong (old) - # parent but then are reassigned to the correct one thanks - # to the (4, ...) - d,t = rel.copy_data(cr, uid, rel_id, context=context) - res.append((0, 0, d)) - trans_data += t + if data[f] != False: + for rel_id in data[f]: + # the lines are first duplicated using the wrong (old) + # parent but then are reassigned to the correct one thanks + # to the (4, ...) + d,t = rel.copy_data(cr, uid, rel_id, context=context) + res.append((0, 0, d)) + trans_data += t data[f] = res elif ftype == 'many2many': data[f] = [(6, 0, data[f])]