[FIX] crm: add missing compute_sudo on crm.lead.company_currency

The field `company_currency` is indirectly used by portal users, and
does not seem to be a security concern in that context.  But as portal
users cannot read companies, the field should be computed in superuser
mode.  This apparently used to work by accident in the past...

closes odoo/odoo#95325

Signed-off-by: Raphael Collet <rco@odoo.com>
This commit is contained in:
Raphael Collet
2022-07-14 22:45:44 +02:00
parent fa49e347e9
commit c2293ca70c
+1 -1
View File
@@ -150,7 +150,7 @@ class Lead(models.Model):
compute="_compute_recurring_revenue_monthly")
recurring_revenue_monthly_prorated = fields.Monetary('Prorated MRR', currency_field='company_currency', store=True,
compute="_compute_recurring_revenue_monthly_prorated")
company_currency = fields.Many2one("res.currency", string='Currency', compute="_compute_company_currency", readonly=True)
company_currency = fields.Many2one("res.currency", string='Currency', compute="_compute_company_currency", compute_sudo=True)
# Dates
date_closed = fields.Datetime('Closed Date', readonly=True, copy=False)
date_action_last = fields.Datetime('Last Action', readonly=True)