# -*- coding: utf-8 -*-

from odoo import api, fields, models, _


class Project(models.Model):
    _inherit = 'project.project'


    def action_view_allocation_custom_report3(self):
        action = self.env["ir.actions.actions"]._for_xml_id("project_report.project_revenue_custom_report3_action")
        if self.is_sub_project and self.parent_project:
            action['context'] = {'search_default_project_id': self.parent_project.id,
                                 'search_default_group_sub_project': 1,
                                 'search_default_group_employee': 1,
                                 'search_default_group_enddate': 1,
                                 # 'default_res_model': 'project.revenue.custom.report3'
                                 }
        else:
            action['context'] = {'search_default_project_id': self.id,
                                 'search_default_project': 1,
                                 'search_default_group_employee': 1,
                                 'search_default_group_enddate': 1,
                                 # 'default_res_model': 'project.revenue.custom.report3'
                                 }
        print(action['context'])
        return action



