-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] project_tech_lead: onchange on tech_lead_id
- Loading branch information
Tiago Amaral
committed
Sep 12, 2024
1 parent
f5c467d
commit 848c4f2
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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])), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters