# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import controllers from . import models from . import report from . import wizard from . import populate from odoo import api, SUPERUSER_ID def _check_exists_collaborators_for_project_sharing(env): """ Check if it exists at least a collaborator in a shared project If it is the case we need to active the portal rules added only for this feature. """ collaborator = env['project.collaborator'].search([], limit=1) if collaborator: # Then we need to enable the access rights linked to project sharing for the portal user env['project.collaborator']._toggle_project_sharing_portal_rules(True) def _project_post_init(cr, registry): env = api.Environment(cr, SUPERUSER_ID, {}) _check_exists_collaborators_for_project_sharing(env)