merge
This commit is contained in:
commit
bee4902c09
2 files changed
+11
-14
No files matched your search
@@ -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')
|
||||
|
||||
+10
-13
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user