From cb9f48d3a91d15c9004201beada26ad570f9d016 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 20 Aug 2019 13:32:25 +0000 Subject: [PATCH] [FIX] website: proper override of auth_signup Add the dependency between website and auth_signup auth_signup is in auto-install but there was no strict dependency Before this commit, installing website transformed the field auth_signup_uninvited from a static list to a computed list (due to related). This fixes the following bug: 1. install auth_signup -> create selections 2. install webstite -> remove selections and turn it into a computed field with dynamic selections 3. update auth_signup -> recreate the selections when updating the module 4. reload the registry (automatic at the end of update) -> try to remove the selections -> error as not in install/uninstall mode Instead, keep the list static and turn it into a computed field with inverse closes odoo/odoo#35861 Signed-off-by: Martin Trigaux (mat) --- addons/website/__manifest__.py | 1 + addons/website/models/res_config_settings.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/website/__manifest__.py b/addons/website/__manifest__.py index 7a91da01ad7..82483b63bd2 100644 --- a/addons/website/__manifest__.py +++ b/addons/website/__manifest__.py @@ -15,6 +15,7 @@ 'http_routing', 'portal', 'social_media', + 'auth_signup', ], 'installable': True, 'data': [ diff --git a/addons/website/models/res_config_settings.py b/addons/website/models/res_config_settings.py index c6a192ae733..6bcae68b61f 100644 --- a/addons/website/models/res_config_settings.py +++ b/addons/website/models/res_config_settings.py @@ -40,7 +40,8 @@ class ResConfigSettings(models.TransientModel): cdn_filters = fields.Text(related='website_id.cdn_filters', readonly=False) module_website_version = fields.Boolean("A/B Testing") module_website_links = fields.Boolean("Link Trackers") - auth_signup_uninvited = fields.Selection("Customer Account", related='website_id.auth_signup_uninvited', readonly=False) + auth_signup_uninvited = fields.Selection(compute="_compute_auth_signup", + inverse="_set_auth_signup") social_twitter = fields.Char(related='website_id.social_twitter', readonly=False) social_facebook = fields.Char(related='website_id.social_facebook', readonly=False) @@ -73,6 +74,15 @@ class ResConfigSettings(models.TransientModel): google_maps_api_key = fields.Char(related='website_id.google_maps_api_key', readonly=False) group_multi_website = fields.Boolean("Multi-website", implied_group="website.group_multi_website") + @api.depends('website_id.auth_signup_uninvited') + def _compute_auth_signup(self): + for config in self: + config.auth_signup_uninvited = config.website_id.auth_signup_uninvited + + def _set_auth_signup(self): + for config in self: + config.website_id.auth_signup_uninvited = config.auth_signup_uninvited + @api.depends('website_id') def has_google_analytics(self): self.has_google_analytics = bool(self.google_analytics_key)