[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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user