[FIX] website_sale: default website team is set trough onchange
Steps to reproduce: - Install eCommerce - Check in website setting that the sales team is website - Logout - Without being logged, buy a product (all the cart flow, until the end) - Once the flow is finished, connect with the admin - Go to website > Orders > Unpaid Orders (since only wired is set when you create the db) - Go to the tab "Other Info" of the SO you just created when buying the product Previous behavior: the sales team set in website settings is overriden during the "/shop/address" endpoint Current behavior: the team set in website settings is used for sale orders coming from website opw-2231654 closes odoo/odoo#51959 X-original-commit: 919077638bc9e8a5ad1c800b629aa0eaa079f571 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
This commit is contained in:
@@ -375,7 +375,8 @@ 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(domain=['|', ('company_id', '=', self.company_id.id), ('company_id', '=', False)],user_id=user_id)
|
||||
if not self.env.context.get('not_self_saleperson') or not self.team_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