[FIX] website_crm: contact us form create lead without salesteam and with channel 'Website'

No sales team is assigned because:
1. This is not cleary explained anywhere that the sales team which will have the lead should have "Website" in its code.
2. Assigning the leads coming from the website to one specific sales team is not enough generic and does not cover all cases. For instance, assignation can be done on the customer country/language, not that it comes from the website.
3. The actual way to filter leads coming from the site is to assign the channel "Website" to the lead

bzr revid: dle@openerp.com-20140129134114-686ytvsck8osrzr9
This commit is contained in:
Denis Ledoux 2014-01-29 14:41:14 +01:00
parent dbcdbab2ba
commit 905e92d81c
1 changed files with 5 additions and 5 deletions

View File

@ -40,14 +40,14 @@ class contactus(http.Controller):
# if not given: subject is contact name
if not post.get('name'):
post['name'] = post.get('contact_name')
section_ids = request.registry["crm.case.section"].search(
request.cr, SUPERUSER_ID, [("code", "=", "Website")], context=request.context)
if section_ids:
post['section_id'] = section_ids[0]
post['user_id'] = False
try:
post['channel_id'] = request.registry['ir.model.data'].get_object_reference(request.cr, SUPERUSER_ID, 'crm', 'crm_case_channel_website')[1]
except ValueError:
pass
request.registry['crm.lead'].create(request.cr, SUPERUSER_ID, post, request.context)
company = request.website.company_id
values = {