[FIX] sale: wrong default sales team in eCommerce orders
Side effect of commit 6d7bbd3074e6b3771b582bf544624cef59e1c6a3. In case we are coming from public route /shop/address, we are in superuser mode and method _get_default_team_id can return a sales team from another company. We should force the domain to avoid creating inconsistent records. closes odoo/odoo#50581 X-original-commit: 0396c04ce894df80fb7714edb06e9befebdb672e Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
This commit is contained in:
@@ -376,8 +376,7 @@ class SaleOrder(models.Model):
|
||||
|
||||
if self.env['ir.config_parameter'].sudo().get_param('account.use_invoice_terms') and self.env.company.invoice_terms:
|
||||
values['note'] = self.with_context(lang=self.partner_id.lang).env.company.invoice_terms
|
||||
|
||||
values['team_id'] = self.env['crm.team']._get_default_team_id(user_id=user_id)
|
||||
values['team_id'] = self.env['crm.team']._get_default_team_id(domain=['|', ('company_id', '=', self.company_id.id), ('company_id', '=', False)],user_id=user_id)
|
||||
self.update(values)
|
||||
|
||||
@api.onchange('user_id')
|
||||
|
||||
Reference in New Issue
Block a user