diff --git a/project_parent_task/__init__.py b/project_parent_task/__init__.py index e69de29..0650744 100644 --- a/project_parent_task/__init__.py +++ b/project_parent_task/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/project_parent_task/__manifest__.py b/project_parent_task/__manifest__.py index f855af4..ccaad95 100644 --- a/project_parent_task/__manifest__.py +++ b/project_parent_task/__manifest__.py @@ -3,7 +3,7 @@ { "name": "project_parent_tasks", - "version": "14.0.1.0.0", + "version": "14.0.1.1.0", "author": "Elabore", "website": "https://elabore.coop", "maintainer": "Laetitia Da Costa", diff --git a/project_parent_task/models/__init__.py b/project_parent_task/models/__init__.py new file mode 100644 index 0000000..cfd8e16 --- /dev/null +++ b/project_parent_task/models/__init__.py @@ -0,0 +1 @@ +from . import project_task \ No newline at end of file diff --git a/project_parent_task/models/project_task.py b/project_parent_task/models/project_task.py new file mode 100644 index 0000000..73f9300 --- /dev/null +++ b/project_parent_task/models/project_task.py @@ -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 \ No newline at end of file diff --git a/project_parent_task/views/project_task.xml b/project_parent_task/views/project_task.xml index 816e3dd..97d09e8 100644 --- a/project_parent_task/views/project_task.xml +++ b/project_parent_task/views/project_task.xml @@ -6,7 +6,7 @@ - [('project_id','=', active_id)] + [('project_id','=', project_id)]