[FIX] auth_signup: compute signup_valid in sudo
Before this commit, the signup_valid field was miscomputed probably due to some env mayhem. Hence the banner with the link to reset the password was never shown After this commit, the field is well computed, and the banner displays OPW 1894390 closes odoo/odoo#27901
This commit is contained in:
@@ -27,14 +27,14 @@ class ResPartner(models.Model):
|
||||
signup_token = fields.Char(copy=False, groups="base.group_erp_manager")
|
||||
signup_type = fields.Char(string='Signup Token Type', copy=False, groups="base.group_erp_manager")
|
||||
signup_expiration = fields.Datetime(copy=False, groups="base.group_erp_manager")
|
||||
signup_valid = fields.Boolean(compute='_compute_signup_valid', string='Signup Token is Valid')
|
||||
signup_valid = fields.Boolean(compute='_compute_signup_valid', string='Signup Token is Valid', compute_sudo=True)
|
||||
signup_url = fields.Char(compute='_compute_signup_url', string='Signup URL')
|
||||
|
||||
@api.multi
|
||||
@api.depends('signup_token', 'signup_expiration')
|
||||
def _compute_signup_valid(self):
|
||||
dt = now()
|
||||
for partner in self.sudo():
|
||||
for partner in self:
|
||||
partner.signup_valid = bool(partner.signup_token) and \
|
||||
(not partner.signup_expiration or dt <= partner.signup_expiration)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user