From 235a9da5dbfc7dbbbe7222c23cddff5d95b55bea Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Wed, 3 Jul 2019 14:41:42 +0000 Subject: [PATCH] [FIX] base: oversight of 547118d76fbd7c34bc164f304b0b9ca3031f4a10 The aforementioned commit prevented the creation of automatic xmlids for custom fields, however this change is not exactly stable; if a database already contains automatic xmlids for custom fields and the module to which these xmlids belong to is upgraded, the xmlids would get deleted, along with any records related to it because of the way that `_update_xmlids` works. This commit leaves existing automatic xmlids of custom fields while preventing the creation of *new* ones. closes odoo/odoo#34563 Signed-off-by: Christophe Simonis --- odoo/addons/base/models/ir_model.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/odoo/addons/base/models/ir_model.py b/odoo/addons/base/models/ir_model.py index 28097acf665..6a43eca2783 100644 --- a/odoo/addons/base/models/ir_model.py +++ b/odoo/addons/base/models/ir_model.py @@ -855,8 +855,13 @@ class IrModelFields(models.Model): keys = [key for key in new_vals if old_vals[key] != new_vals[key]] self.pool.post_init(record.modified, keys) old_vals.update(new_vals) - if module and not field.manual and (module == model._original_module or module in field._modules): - to_xmlids.append(name) + if module and (module == model._original_module or module in field._modules): + # remove this and only keep the else clause if version >= saas-12.4 + if field.manual: + self.pool.loaded_xmlids.add( + '%s.field_%s__%s' % (module, model._name.replace('.', '_'), name)) + else: + to_xmlids.append(name) if to_insert: # insert missing fields