[FIX] sale, website_sale: salesperson emails from assignation of online so
- install e-commerce;
- In the website settings, orders followup, set a salesperson;
- By something as a public user;
- Pay the order.
Before this commit:
- 2 emails where create to assign the salesperson to the SO, but these
emails didn't have a from and the salesperson didn't receive the
emails.
- 1 email was also create to assign the salesperson to the contact, this
mail is not necessary.
Now, only one email that assigns the salesperson to the SO is sent,
with a correct from address.
opw-2189683
closes odoo/odoo#44861
X-original-commit: 7c08eb158858b9573d3d84a0b54df0bfca754105
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
@@ -348,8 +348,11 @@ class SaleOrder(models.Model):
|
||||
'payment_term_id': self.partner_id.property_payment_term_id and self.partner_id.property_payment_term_id.id or False,
|
||||
'partner_invoice_id': addr['invoice'],
|
||||
'partner_shipping_id': addr['delivery'],
|
||||
'user_id': partner_user.id or self.env.uid
|
||||
}
|
||||
user_id = partner_user.id or self.env.uid
|
||||
if self.user_id.id != user_id:
|
||||
values['user_id'] = user_id
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ class WebsiteSale(http.Controller):
|
||||
def _checkout_form_save(self, mode, checkout, all_values):
|
||||
Partner = request.env['res.partner']
|
||||
if mode[0] == 'new':
|
||||
partner_id = Partner.sudo().create(checkout).id
|
||||
partner_id = Partner.sudo().with_context(tracking_disable=True).create(checkout).id
|
||||
elif mode[0] == 'edit':
|
||||
partner_id = int(all_values.get('partner_id', 0))
|
||||
if partner_id:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import api, fields, models, tools
|
||||
from odoo import api, fields, models, tools, SUPERUSER_ID
|
||||
|
||||
from odoo.http import request
|
||||
from odoo.addons.website.models import ir_http
|
||||
@@ -274,7 +274,7 @@ class Website(models.Model):
|
||||
# TODO cache partner_id session
|
||||
pricelist = self.env['product.pricelist'].browse(pricelist_id).sudo()
|
||||
so_data = self._prepare_sale_order_values(partner, pricelist)
|
||||
sale_order = self.env['sale.order'].with_company(request.website.company_id.id).sudo().create(so_data)
|
||||
sale_order = self.env['sale.order'].with_company(request.website.company_id.id).with_user(SUPERUSER_ID).create(so_data)
|
||||
|
||||
# set fiscal position
|
||||
if request.website.partner_id.id != partner.id:
|
||||
|
||||
Reference in New Issue
Block a user