diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-09-20 17:33:22 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-09-20 17:34:45 +0200 |
| commit | 64e43808b79badb5869a8d73cc1cc3f3b3aa8e12 (patch) | |
| tree | 9a22d5f6c03073a4d10faedea8df23a5211e8b8f /odoo/fields.py | |
| parent | 944891ced081cda3b8b3db5faf3b7ac23b6b4ce8 (diff) | |
| parent | 58a83d12228fbbd4e9dde542e133d264204ee0f3 (diff) | |
[MERGE] forward port branch saas-12.5 up to 58a83d12228
Diffstat (limited to 'odoo/fields.py')
| -rw-r--r-- | odoo/fields.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/odoo/fields.py b/odoo/fields.py index dc685d7885b..2576fd770ac 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -1435,8 +1435,8 @@ class _String(Field): update_column = True update_trans = True elif lang != 'en_US': - # update the translations only - update_column = False + # update the translations only except if emptying + update_column = cache_value is None update_trans = True # update towrite if modifying the source @@ -1445,7 +1445,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: + if self.translate is True and cache_value is not None: tname = "%s,%s" % (records._name, self.name) records.env['ir.translation']._set_source(tname, real_recs._ids, value) @@ -1464,7 +1464,13 @@ class _String(Field): source_recs[self.name] = value source_value = value tname = "%s,%s" % (self.model_name, self.name) - if single_lang: + if value is None: + records.env['ir.translation'].search([ + ('name', '=', tname), + ('type', '=', 'model'), + ('res_id', 'in', real_recs._ids) + ]).unlink() + elif single_lang: records.env['ir.translation']._update_translations([dict( src=source_value, value=value, |
