Skip to content
Snippets Groups Projects
Commit 6dc985b0 authored by Jeremy Kersten's avatar Jeremy Kersten
Browse files

[FIX] website_crm_partner_assign: allow partner to be uninteressed for a lead.

Avoid traceback "'int' object has no attribute 'partner_id'"
uid is the id and not the browser record of 'user'

Avoid traceback: Database fetch misses ids (u'<id>') and has extra ids (<id>),
 may be caused by a type incoherence in a previous request.
JS call with id as string.

Avoid traceback: Invalid value res.partner(x,y,z) in domain term ('partner_id', 'in', res.partner(x,y,z))
Search in new api return browseRecord now

Avoid to write on a lead without the right on it.
parent 6d8ae0a0
No related branches found
No related tags found
No related merge requests found
......@@ -204,8 +204,8 @@ class CrmLead(models.Model):
else:
message = _('<p>I am not interested by this lead. I have not contacted the lead.</p>')
partner_ids = self.env['res.partner'].search(
[('id', 'child_of', self.env.uid.partner_id.commercial_partner_id.id)])
self.sudo().message_unsubscribe(partner_ids)
[('id', 'child_of', self.env.user.partner_id.commercial_partner_id.id)])
self.sudo().message_unsubscribe(partner_ids=partner_ids.ids)
if comment:
message += '<p>%s</p>' % comment
self.message_post(body=message, subtype="mail.mt_note")
......@@ -213,8 +213,8 @@ class CrmLead(models.Model):
'partner_assigned_id': False
}
if partner_ids:
values['partner_declined_ids'] = map(lambda p: (4, p, 0), partner_ids)
self.write(values)
values['partner_declined_ids'] = map(lambda p: (4, p, 0), partner_ids.ids)
self.sudo().write(values)
@api.multi
def update_lead_portal(self, values):
......
......@@ -35,7 +35,7 @@ $('.interested_partner_assign_confirm').on('click',function(e){
$('.desinterested_partner_assign_confirm').on('click',function(e){
new Model('crm.lead')
.call("partner_desinterested",
[[$('.desinterested_partner_assign_form .assign_lead_id').val()],
[[parseInt($('.desinterested_partner_assign_form .assign_lead_id').val())],
$('.desinterested_partner_assign_form .comment_desinterested').val(),
$('.desinterested_partner_assign_form .contacted_desinterested').prop('checked')])
.then(function(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment