diff options
| author | Ivan Yelizariev <iel@odoo.com> | 2021-01-08 09:30:30 +0000 |
|---|---|---|
| committer | Ivan Yelizariev <iel@odoo.com> | 2021-01-15 10:04:57 +0000 |
| commit | 3ef5e63f62f0f84d6e92cb55eb112ab2f2924faa (patch) | |
| tree | d7c5f1b24de5e4b204b3a535b0a50533e48764bc /odoo/fields.py | |
| parent | bca1a13a846b3398a70f12be259a425df140a8f7 (diff) | |
[FIX] odoo/fields.py: fix removing translations on writing ''
cache_value could be empty string rather than None. I'm not sure why it was
different before.
STEPS:
* install an app that adds menu Products (e.g. Sales)
* activate second language and switch to it
* create new product, set some value to field description ("Internal Notes"),
save
* click edit, remove description, save
BEFORE: the value is not removed
AFTER: value is empty, translations are removed
closes odoo/odoo#64591
X-original-commit: 32465251e19efe63d2015b799b8de9b4e8db438f
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/odoo/fields.py b/odoo/fields.py index 710663866d0..8e940a3a387 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -1497,7 +1497,7 @@ class _String(Field): update_trans = True elif lang != 'en_US' and lang is not None: # update the translations only except if emptying - update_column = cache_value is None + update_column = not cache_value update_trans = True # else: lang = None @@ -1507,7 +1507,7 @@ class _String(Field): for rid in real_recs._ids: # cache_value is already in database format towrite[rid][self.name] = cache_value - if self.translate is True and cache_value is not None: + if self.translate is True and cache_value: tname = "%s,%s" % (records._name, self.name) records.env['ir.translation']._set_source(tname, real_recs._ids, value) if self.translate: @@ -1530,7 +1530,7 @@ class _String(Field): source_recs[self.name] = value source_value = value tname = "%s,%s" % (self.model_name, self.name) - if value is None: + if not value: records.env['ir.translation'].search([ ('name', '=', tname), ('type', '=', 'model'), |
