-
-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by rafaelbn
- Loading branch information
Showing
9 changed files
with
121 additions
and
13 deletions.
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
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
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,2 +1,4 @@ | ||
from . import res_config_settings | ||
from . import res_company | ||
from . import project_task | ||
from . import crm_lead |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2023 Moduon Team S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class CrmLead(models.Model): | ||
_inherit = "crm.lead" | ||
|
||
task_ids = fields.One2many("project.task", "lead_id") | ||
task_count = fields.Integer("#Task", compute="_compute_task_count") | ||
|
||
@api.depends("task_ids") | ||
def _compute_task_count(self): | ||
for lead in self: | ||
lead.task_count = len(lead.task_ids) | ||
|
||
def action_tasks(self): | ||
self.ensure_one() | ||
ctx = self._context.copy() | ||
action = self.env.ref("project.action_view_task").sudo().read()[0] | ||
ctx.update({"default_lead_id": self.id}) | ||
action.update({"context": ctx, "domain": [("lead_id", "=", self.id)]}) | ||
return action |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2023 Moduon Team S.L. | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class CrmLead(models.Model): | ||
_inherit = "project.task" | ||
|
||
lead_id = fields.Many2one("crm.lead") |
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
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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- Copyright 2023 Moduon Team S.L. | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) --> | ||
<odoo> | ||
<record id="view_task_form2_inherit_crm_project_task" model="ir.ui.view"> | ||
<field name="name">project.task.form.inherit</field> | ||
<field name="model">project.task</field> | ||
<field name="inherit_id" ref="project.view_task_form2" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//page[@name='extra_info']" position="inside"> | ||
<group name="crm" string="Lead/Opportunity"> | ||
<field name="lead_id" /> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
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