xml import: Fetch the correct default value when a field belongs to

the parent model of the record.
This commit is contained in:
Bertrand Chenal committed 2009-01-25 00:47:00 +01:00
1 parent 116a713503
commit 406692ab69
1 file changed
+8 -2
+8 -2
View File
@@ -683,8 +683,14 @@ class TrytondXmlHandler(sax.handler.ContentHandler):
# we cannot update a field if it was changed by a user...
if key not in old_values:
expected_value = object_ref._defaults.get(
key, lambda *a:None)(cursor, user)
if key in object_ref._inherit_fields:
parent_obj = self.pool.get(
object_ref._inherit_fields[key][0])
expected_value = parent_obj._defaults.get(
key, lambda *a: None)(cursor, user)
else:
expected_value = object_ref._defaults.get(
key, lambda *a: None)(cursor, user)
else:
expected_value = old_values[key]