diff --git a/cor_custom/views/project_view.xml b/cor_custom/views/project_view.xml index e016fd7..7aa811f 100755 --- a/cor_custom/views/project_view.xml +++ b/cor_custom/views/project_view.xml @@ -189,6 +189,7 @@ tree,kanban,form + [('is_sub_project', '=', False)] main

diff --git a/sub_project/models/sub_project.py b/sub_project/models/sub_project.py index ea1c067..19964f4 100755 --- a/sub_project/models/sub_project.py +++ b/sub_project/models/sub_project.py @@ -8,6 +8,18 @@ class SubProject(models.Model): is_sub_project = fields.Boolean("Is Sub Project") sub_project = fields.Many2many('project.project', 'project_subproject_rel', 'project_id', 'id', domain="[('is_sub_project', '=', True)]", string='Sub Project') + parent_project = fields.Many2one('project.project', string='Parent Project') + + @api.depends('sub_project') + def onchange_parent_project_sub_project(self): + for record in self: + if record.sub_project: + print('111111111', record.sub_project) + for rec in record.sub_project: + print('2222222', rec, record.id, record._origin.id) + #print('2222222AAAAAAAAAAAA', rec.parent_project) + #rec.write({'parent_project' : record._origin.id}) + # print('3333333', rec.parent_project) class InheritProjectTask(models.Model): diff --git a/sub_project/views/sub_project.xml b/sub_project/views/sub_project.xml index ef752ef..aa352ca 100755 --- a/sub_project/views/sub_project.xml +++ b/sub_project/views/sub_project.xml @@ -11,8 +11,12 @@ + + + - + @@ -38,12 +42,46 @@ + + + + project.sub.project.tree + project.project + + + + + + + + + + + + + + + + + + + + Sub Project ir.actions.act_window project.project tree,form + {'default_is_sub_project': True} [('is_sub_project', '=', True)] @@ -55,10 +93,10 @@ + name="Sub Project" + action="action_sub_project" + parent="project.menu_main_pm" + sequence="2"/> \ No newline at end of file