[FIX] survey: do not always get answer_score
Calling `_get_answer_score_values` on each question creation or update is not necessary if value is already provided. Followup of odoo/odoo@0d32ed45ae closes odoo/odoo#76223 X-original-commit: c6c7605cdae803aca4f441ef4e622a1b79f17019 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
committed by
Thibault Delavallée
parent
1e0150fd64
commit
5a6057e5fd
@@ -604,8 +604,8 @@ class SurveyUserInputLine(models.Model):
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
score_vals = self._get_answer_score_values(vals)
|
||||
if not vals.get('answer_score'):
|
||||
score_vals = self._get_answer_score_values(vals)
|
||||
vals.update(score_vals)
|
||||
return super(SurveyUserInputLine, self).create(vals_list)
|
||||
|
||||
@@ -619,8 +619,8 @@ class SurveyUserInputLine(models.Model):
|
||||
'question_id': line.question_id.id,
|
||||
**vals_copy
|
||||
}
|
||||
score_vals = self._get_answer_score_values(getter_params, compute_speed_score=False)
|
||||
if not vals_copy.get('answer_score'):
|
||||
score_vals = self._get_answer_score_values(getter_params, compute_speed_score=False)
|
||||
vals_copy.update(score_vals)
|
||||
res = super(SurveyUserInputLine, line).write(vals_copy) and res
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user