mirror of
https://github.com/bringout/oca-project.git
synced 2026-04-18 21:22:09 +02:00
Move 124 sale modules to oca-sale, create oca-project with 56 project modules from oca-workflow-process
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9eb7ae5807
commit
6094c218b2
2332 changed files with 125826 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
from . import project_task
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright (C) 2022 ForgeFlow S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProjectTask(models.Model):
|
||||
_inherit = "project.task"
|
||||
|
||||
def action_duplicate_subtasks(self):
|
||||
action = self.env.ref("project.action_view_task")
|
||||
result = action.read()[0]
|
||||
task_created = self.env["project.task"]
|
||||
for task in self:
|
||||
new_task = task.copy()
|
||||
task_created |= new_task
|
||||
if task.child_ids:
|
||||
|
||||
def duplicate_childs(task, new_task):
|
||||
if task.child_ids:
|
||||
for child in task.child_ids:
|
||||
new_subtask = child.copy()
|
||||
new_subtask.write({"parent_id": new_task.id})
|
||||
duplicate_childs(child, new_subtask)
|
||||
|
||||
duplicate_childs(task, new_task)
|
||||
|
||||
if len(task_created) == 1:
|
||||
res = self.env.ref("project.view_task_form2")
|
||||
result["views"] = [(res and res.id or False, "form")]
|
||||
result["res_id"] = new_task.id
|
||||
action["context"] = {
|
||||
"form_view_initial_mode": "edit",
|
||||
"force_detailed_view": "true",
|
||||
}
|
||||
|
||||
else:
|
||||
result["domain"] = "[('id', 'in', " + str(task_created.ids) + ")]"
|
||||
return result
|
||||
Loading…
Add table
Add a link
Reference in a new issue