[IMP] sale: apply salesman group on utm campagins counter and apply compute sudo

The goal is that the counter on the smart button can display the conmplete
information ("this campaing generated 500k€, no matter if you can acces or not
the records behind this number").
Once the user clicks on the smart button, them can only see the records he has
access to.

Task-2516278
COM PR: odoo/odoo#76934
ENT PR: odoo/enterprise#21055

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
David Beguin
2021-11-29 20:11:24 +00:00
committed by Thibault Delavallée
parent 73399ddc1c
commit ff4ca4fa90
+4 -2
View File
@@ -7,8 +7,10 @@ class UtmCampaign(models.Model):
_inherit = 'utm.campaign'
_description = 'UTM Campaign'
quotation_count = fields.Integer('Quotation Count', groups='sales_team.group_sale_salesman', compute="_compute_quotation_count")
invoiced_amount = fields.Integer(default=0, compute="_compute_sale_invoiced_amount", string="Revenues generated by the campaign")
quotation_count = fields.Integer('Quotation Count',
compute="_compute_quotation_count", compute_sudo=True, groups='sales_team.group_sale_salesman')
invoiced_amount = fields.Integer(string="Revenues generated by the campaign",
compute="_compute_sale_invoiced_amount", compute_sudo=True, groups='sales_team.group_sale_salesman')
company_id = fields.Many2one('res.company', string='Company', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.company)
currency_id = fields.Many2one('res.currency', related='company_id.currency_id', string='Currency')