Merge pull request #4665 from expsa/youneskches_test

IMP benefit
This commit is contained in:
kchyounes19 2025-09-15 15:50:20 +01:00 committed by GitHub
commit 8961704243
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ class Visit(models.Model):
default=lambda self: _('New'))
otp_code = fields.Char(string="OTP Code", readonly=True, copy=False)
otp_generated_at = fields.Datetime(string="OTP Generated At", readonly=True, copy=False)
response_id = fields.Many2one('survey.user_input', string="Survey Responses", ondelete='restrict', copy=False)
response_id = fields.Many2one('survey.user_input', string="Survey Responses", copy=False)
response_count = fields.Integer(compute="_compute_response_count", store=True, string="Responses Count", copy=False)
survey_url = fields.Char(string="Survey URL")
@ -239,7 +239,7 @@ class Visit(models.Model):
if self.response_id:
response = self.response_id
if response.survey_id.id != survey.id or response.state != 'done':
response.unlink()
response.sudo().unlink()
self.response_id = False
if not self.response_id: