[FIX] crm: get pls probabilities with sudo

Portal user that have opportunities in their portal
may change the stage of the opportunity
Changing the stage on the portal trigger
direcly the method write.

With the pls, write on the stage
trigger the recompute of the probabilities
that read on crm.lead.scoring.frequency
which portal user don't have acess

closes odoo/odoo#46551

Solution: compute probabilities in sudo mode
X-original-commit: 9cd7fe0ff3ce07618635b4d13ca564bd2f326980
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
Thibault Francois
2020-02-28 12:22:03 +00:00
parent ef863e812b
commit 49fc39b202
+1 -1
View File
@@ -447,7 +447,7 @@ class Lead(models.Model):
return write_result
def _update_probability(self):
lead_probabilities = self._pls_get_naive_bayes_probabilities()
lead_probabilities = self.sudo()._pls_get_naive_bayes_probabilities()
for lead in self:
if lead.id in lead_probabilities:
lead_proba = lead_probabilities[lead.id]