[FIX] website_crm: 2 fixes commit, yeah
- admin is not follower anymore of all leads created through the contact form. The famous no_subscribe key is added in the context for that purpose. - fixed medium and sales_team of the contact form leads. A bad xml_id + bad use of get_object_reference + bad use of try/catch prevented from having any of those. It now works correctly even if the medium and/or sales team has been deleted. Courtesy of Use Merge: Yannick Tivisse. Reviewed by Use Merge: Thibault Delavallée. I think this commit message is waaaay longer than the commit itself, although I think I will never beat Olivier or Martin. Those two are able to write 3 pages of commit messages when doing a one-line fix. Well, this fix can be tricky to understand but, hey, I am not writing stupid things just to gain some characters. Not my style. Have a good day.
This commit is contained in:
parent
d023c079ed
commit
ecb4638a70
|
@ -28,7 +28,8 @@ class contactus(http.Controller):
|
|||
|
||||
def create_lead(self, request, values, kwargs):
|
||||
""" Allow to be overrided """
|
||||
return request.registry['crm.lead'].create(request.cr, SUPERUSER_ID, values, request.context)
|
||||
cr, context = request.cr, request.context
|
||||
return request.registry['crm.lead'].create(cr, SUPERUSER_ID, values, context=dict(context, mail_create_nosubscribe=True))
|
||||
|
||||
def preRenderThanks(self, values, kwargs):
|
||||
""" Allow to be overrided """
|
||||
|
@ -76,11 +77,8 @@ class contactus(http.Controller):
|
|||
values = dict(values, error=error, kwargs=kwargs.items())
|
||||
return request.website.render(kwargs.get("view_from", "website.contactus"), values)
|
||||
|
||||
try:
|
||||
values['medium_id'] = request.registry['ir.model.data'].get_object_reference(request.cr, SUPERUSER_ID, 'crm', 'crm_tracking_medium_website')[1]
|
||||
values['medium_id'] = request.registry['ir.model.data'].xmlid_to_res_id(request.cr, SUPERUSER_ID, 'crm.crm_medium_website')
|
||||
values['section_id'] = request.registry['ir.model.data'].xmlid_to_res_id(request.cr, SUPERUSER_ID, 'website.salesteam_website_sales')
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# description is required, so it is always already initialized
|
||||
if post_description:
|
||||
|
|
Loading…
Reference in New Issue