[FIX] orm: do not save empty translation as 'false'
When writting a value on a translatable field in a different language than English, the submitted *raw* value was saved in the database. This could cause the following issues: - empty value (provided as `False` by the web client) saved as the string 'false' in the translations table - no encoding or sanitization convertion - ignore size parameter on the translatable field Process the submitted translation through symbol_set method to clean it before storing it blindly in the database. This allows to convert `False` into `''` for empty value and fixes #10862
This commit is contained in:
parent
600f884524
commit
fd7a7207ac
|
@ -3910,7 +3910,8 @@ class BaseModel(object):
|
|||
# Inserting value to DB
|
||||
context_wo_lang = dict(context, lang=None)
|
||||
self.write(cr, user, ids, {f: vals[f]}, context=context_wo_lang)
|
||||
self.pool.get('ir.translation')._set_ids(cr, user, self._name+','+f, 'model', context['lang'], ids, vals[f], src_trans)
|
||||
translation_value = self._columns[f]._symbol_set[1](vals[f])
|
||||
self.pool['ir.translation']._set_ids(cr, user, self._name+','+f, 'model', context['lang'], ids, translation_value, src_trans)
|
||||
|
||||
# invalidate and mark new-style fields to recompute; do this before
|
||||
# setting other fields, because it can require the value of computed
|
||||
|
|
Loading…
Reference in New Issue