[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) <mat@odoo.com>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
'http_routing',
|
||||
'portal',
|
||||
'social_media',
|
||||
'auth_signup',
|
||||
],
|
||||
'installable': True,
|
||||
'data': [
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user