diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py index 5b56f1a050..2fade9c6fb 100644 --- a/trytond/ir/translation.py +++ b/trytond/ir/translation.py @@ -31,7 +31,7 @@ class Translation(OSV, Cacheable): _description = __doc__ name = fields.Char('Field Name', size=128, required=True) res_id = fields.Integer('Resource ID') - lang = fields.Selection('get_language', string='Language', size=5), + lang = fields.Selection('get_language', string='Language', size=5) type = fields.Selection(TRANSLATION_TYPE, string='Type', size=16, required=True) src = fields.Text('Source') diff --git a/trytond/tools/convert.py b/trytond/tools/convert.py index 771204c466..05721ca431 100644 --- a/trytond/tools/convert.py +++ b/trytond/tools/convert.py @@ -539,25 +539,22 @@ class TrytondXmlHandler(sax.handler.ContentHandler): if db_field == values[key]: continue - # we cannot update a field if it was changed by a user + # we cannot update a field if it was changed by a user... if key not in old_values: - default_value = object_ref._defaults.get( + expected_value = object_ref._defaults.get( key, lambda *a:None)(cursor, user) - if db_field != default_value: - logger = Logger() + else: + expected_value = old_values[key] - logger.notify_channel('init', LOG_WARNING, - "Field %s of %s@%s not updated (id: %s), because "\ - "it has changed since the last update"% \ - (key, db_id, model, fs_id)) - continue - - elif (old_values[key] and db_field) and \ - old_values[key] != db_field: + # ... and we consider that there is an update if the + # expected value differs from the actual value, _and_ + # if they are not false in a boolean context (ie None, + # False, {} or []) + if db_field != expected_value and (db_field or expected_value) : logger = Logger() logger.notify_channel('init', LOG_WARNING, "Field %s of %s@%s not updated (id: %s), because "\ - "it has changed since the last update."%\ + "it has changed since the last update"% \ (key, db_id, model, fs_id)) continue