[FIX] sale_timesheet: project from SO in multicompany

Have a product of type service with :
- Service tracking : Create a task in a new project
- Project template : A project of the company
- Re-invoicing Policy : No

Create a SO with the product, and validate it.

Before this commit, when the project was generated. It was generated in
the company of the super user, and not in the company of the SO.

Now, the project is generated in the company of the SO.

OPW-1927005

closes odoo/odoo#30607
This commit is contained in:
Jorge Pinna Puissant
2019-01-29 13:11:31 +00:00
parent f22fef1776
commit e2e0101349
+1 -1
View File
@@ -51,7 +51,7 @@ 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()._timesheet_service_generation()
self.mapped('order_line').sudo().with_context(default_company_id=self.company_id.id)._timesheet_service_generation()
return result
@api.multi