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 11, 2024
1 parent f5c467d commit a691736
Showing 1 changed file with 11 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_project_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])),
)

0 comments on commit a691736

Please sign in to comment.