summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2019-03-15 13:55:59 +0000
committerNicolas Martinelli <nim@odoo.com>2019-03-15 14:11:04 +0000
commit72bc566ad8bfea5745fc3ae846d36fd897daf68a (patch)
treefbeee6ff19acc7ad087ebefa384f791c190c5cd2
parenta710a86993cdcda679f4198b9ec9a8b51c0dcd31 (diff)
[FIX] sale_timesheet: project template
- Create 2 companies A & B - Set the superuser in A - Create a product P: Product Type: 'Service' Service Tracking: 'Create a task in a new project' Project Template: set one for both companies - Switch to company B - Create a SO with P, validate - Access the project through the stat button 'Project(s) Overview' An `AccessError` is raised. In case no 'Project Template' has been set for company A, the project is created without the specified template. This is because the new project is created as `sudo`, and the `project_template_id` field is a company-dependant field. Therefore, a project template from company A is used to create a project in company B. opw-1953011 closes odoo/odoo#31883 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
-rw-r--r--addons/sale_timesheet/models/sale_order.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/sale_timesheet/models/sale_order.py b/addons/sale_timesheet/models/sale_order.py
index 75e7953e903..c76798bce10 100644
--- a/addons/sale_timesheet/models/sale_order.py
+++ b/addons/sale_timesheet/models/sale_order.py
@@ -51,7 +51,10 @@ class SaleOrder(models.Model):
def _action_confirm(self):
""" On SO confirmation, some lines should generate a task or a project. """
result = super(SaleOrder, self)._action_confirm()
- self.mapped('order_line').sudo().with_context(default_company_id=self.company_id.id)._timesheet_service_generation()
+ self.mapped('order_line').sudo().with_context(
+ default_company_id=self.company_id.id,
+ force_company=self.company_id.id,
+ )._timesheet_service_generation()
return result
@api.multi