[FIX]project_parent_tasks:change behaviour of autocomplete task sale line
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "project_parent_tasks",
|
"name": "project_parent_tasks",
|
||||||
"version": "14.0.1.0.0",
|
"version": "14.0.1.1.0",
|
||||||
"author": "Elabore",
|
"author": "Elabore",
|
||||||
"website": "https://elabore.coop",
|
"website": "https://elabore.coop",
|
||||||
"maintainer": "Laetitia Da Costa",
|
"maintainer": "Laetitia Da Costa",
|
||||||
|
1
project_parent_task/models/__init__.py
Normal file
1
project_parent_task/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import project_task
|
21
project_parent_task/models/project_task.py
Normal file
21
project_parent_task/models/project_task.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
class Task(models.Model):
|
||||||
|
_inherit = "project.task"
|
||||||
|
|
||||||
|
#overwrite others def _compute_sale_line(self)
|
||||||
|
#we want to skip _compute_sale_line in /home/laetitia/elabore/odoo/OCB/addons/sale_timesheet/models/project.py file
|
||||||
|
|
||||||
|
@api.depends('commercial_partner_id', 'sale_line_id.order_partner_id.commercial_partner_id', 'parent_id.sale_line_id', 'project_id.sale_line_id')
|
||||||
|
def _compute_sale_line(self):
|
||||||
|
for task in self:
|
||||||
|
# check sale_line_id and customer are coherent
|
||||||
|
if task.sale_line_id.order_partner_id.commercial_partner_id != task.partner_id.commercial_partner_id:
|
||||||
|
task.sale_line_id = False
|
||||||
|
if not task.sale_line_id:
|
||||||
|
task.sale_line_id = task.parent_id.sale_line_id or task.project_id.sale_line_id
|
||||||
|
|
||||||
|
@api.onchange('parent_id')
|
||||||
|
def _onchange_parent_id(self):
|
||||||
|
self.sale_line_id = self.parent_id.sale_line_id or self.project_id.sale_line_id
|
@@ -6,7 +6,7 @@
|
|||||||
<field name="inherit_id" ref="project.view_task_form2" />
|
<field name="inherit_id" ref="project.view_task_form2" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='parent_id']" position="attributes">
|
<xpath expr="//field[@name='parent_id']" position="attributes">
|
||||||
<attribute name="domain">[('project_id','=', active_id)]</attribute>
|
<attribute name="domain">[('project_id','=', project_id)]</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
Reference in New Issue
Block a user