Debian Codegraph @

addons/hr_timesheet/models/project_collaborator.py

raw
1 # -*- coding: utf-8 -*-
2 # Part of Odoo. See LICENSE file for full copyright and licensing details.
3
4 from odoo import api, models
5
6
7 class ProjectCollaborator(models.Model):
8 _inherit = 'project.collaborator'
9
10 @api.model
11 def _toggle_project_sharing_portal_rules(self, active):
12 super()._toggle_project_sharing_portal_rules(active)
13 # ir.model.access
14 access_timesheet_portal = self.env.ref('hr_timesheet.access_account_analytic_line_portal_user').sudo()
15 if access_timesheet_portal.active != active:
16 access_timesheet_portal.write({'active': active})
17
18 # ir.rule
19 timesheet_portal_ir_rule = self.env.ref('hr_timesheet.timesheet_line_rule_portal_user').sudo()
20 if timesheet_portal_ir_rule.active != active:
21 timesheet_portal_ir_rule.write({'active': active})