Skip to content

Commit

Permalink
[FIX] project_tech_lead: onchange on tech_lead_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Amaral committed Sep 12, 2024
1 parent f5c467d commit 848c4f2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
12 changes: 11 additions & 1 deletion project_tech_lead/models/project_project.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Copyright 2024 KMEE
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models
from odoo import api, fields, models


class ProjectProject(models.Model):

_inherit = "project.project"

tech_lead_id = fields.Many2one("res.users", string="Tech Lead")

@api.onchange("tech_lead_id")
def _onchange_tech_lead_id(self):
for record in self:
self.env.cr.execute(
"UPDATE project_task "
"SET tech_lead_id = %s "
"WHERE project_id = %s;",
(record.tech_lead_id.id, int(str(record.id).split("_")[1])),
)
11 changes: 11 additions & 0 deletions project_tech_lead/views/project_task.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

<record model="ir.ui.view" id="quick_create_task_form">
<field name="name">quick.create.task.form (in project_tech_lead)</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="project.quick_create_task_form" />
<field name="arch" type="xml">
<field name="project_id" position="after">
<field name="tech_lead_id" force_save="1" invisible="1" />
</field>
</field>
</record>

<record model="ir.ui.view" id="project_task_form_view">
<field name="name">project.task.form (in project_tech_lead)</field>
<field name="model">project.task</field>
Expand Down

0 comments on commit 848c4f2

Please sign in to comment.