summaryrefslogtreecommitdiff
path: root/addons/sale_timesheet_edit/models
diff options
context:
space:
mode:
Diffstat (limited to 'addons/sale_timesheet_edit/models')
-rw-r--r--addons/sale_timesheet_edit/models/__init__.py5
-rw-r--r--addons/sale_timesheet_edit/models/account_analytic_line.py20
-rw-r--r--addons/sale_timesheet_edit/models/project.py15
3 files changed, 40 insertions, 0 deletions
diff --git a/addons/sale_timesheet_edit/models/__init__.py b/addons/sale_timesheet_edit/models/__init__.py
new file mode 100644
index 00000000..bf8826f4
--- /dev/null
+++ b/addons/sale_timesheet_edit/models/__init__.py
@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import account_analytic_line
+from . import project
diff --git a/addons/sale_timesheet_edit/models/account_analytic_line.py b/addons/sale_timesheet_edit/models/account_analytic_line.py
new file mode 100644
index 00000000..5ff797dd
--- /dev/null
+++ b/addons/sale_timesheet_edit/models/account_analytic_line.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, fields, models
+
+
+# TODO: [XBO] merge with account.analytic.line in the sale_timesheet module in master.
+class AccountAnalyticLine(models.Model):
+ _inherit = 'account.analytic.line'
+
+ is_so_line_edited = fields.Boolean()
+
+ @api.depends('task_id.sale_line_id', 'project_id.sale_line_id', 'project_id.allow_billable', 'employee_id')
+ def _compute_so_line(self):
+ super(AccountAnalyticLine, self.filtered(lambda t: not t.is_so_line_edited))._compute_so_line()
+
+ def _check_sale_line_in_project_map(self):
+ # TODO: [XBO] remove me in master, now we authorize to manually edit the so_line, then this so_line can be different of the one in task/project/map_entry
+ # !!! Override of the method in sale_timesheet !!!
+ return
diff --git a/addons/sale_timesheet_edit/models/project.py b/addons/sale_timesheet_edit/models/project.py
new file mode 100644
index 00000000..b10bafdd
--- /dev/null
+++ b/addons/sale_timesheet_edit/models/project.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import models
+
+
+class Project(models.Model):
+ _inherit = 'project.project'
+
+ def _get_not_billed_timesheets(self):
+ """ Get the timesheets not invoiced and the SOL has not manually been edited
+ FIXME: [XBO] this change must be done in the _update_timesheets_sale_line_id
+ rather than this method in master to keep the initial behaviour of this method.
+ """
+ return super(Project, self)._get_not_billed_timesheets() - self.mapped('timesheet_ids').filtered('is_so_line_edited')