[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.
This commit is contained in:
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user