From 49fc39b202f213b3517062d0a33c1c9c3a69fd52 Mon Sep 17 00:00:00 2001 From: Thibault Francois Date: Fri, 21 Feb 2020 16:15:09 +0000 Subject: [PATCH] [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) --- addons/crm/models/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py index b4311beee2a..5a47e3e270d 100644 --- a/addons/crm/models/crm_lead.py +++ b/addons/crm/models/crm_lead.py @@ -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]