mirror of
https://github.com/bringout/oca-workflow-process.git
synced 2026-04-19 04:32:03 +02:00
Initial commit: OCA Workflow Process packages (456 packages)
This commit is contained in:
commit
d366e42934
18799 changed files with 1284507 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
# Copyright 2019 Onestein
|
||||
# Copyright 2020 Manuel Calero - Tecnativa
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class Project(models.Model):
|
||||
_inherit = "project.project"
|
||||
|
||||
project_risk_ids = fields.One2many(
|
||||
comodel_name="project.risk", inverse_name="project_id"
|
||||
)
|
||||
|
||||
project_risk_count = fields.Integer(compute="_compute_risk_count")
|
||||
|
||||
def _compute_risk_count(self):
|
||||
for project in self:
|
||||
project.project_risk_count = len(project.project_risk_ids)
|
||||
|
||||
def view_risk(self):
|
||||
self.ensure_one()
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"project_risk.project_risk_action"
|
||||
)
|
||||
action["context"] = {"default_project_id": self.id}
|
||||
action["domain"] = [("project_id", "=", self.id)]
|
||||
return action
|
||||
Loading…
Add table
Add a link
Reference in a new issue