Skip to Content
Menu
This question has been flagged
2 Replies
2146 Views

hello, I am trying to send custom values to a many2many field in mail template, however, it shows the following error "raise ValueError("Wrong value for %s: %s" % (self, value))"

My code in model.py is 

if latestmessage:
cc =[]
for cclist in latestmessage.cc_recipient_ids:
cc.append(cclist.id)

ctx={

'default_model': 'crm.lead',
'default_res_id': self.ids[0],
'default_use_template': bool(template_id),
'default_template_id': template_id,
'mark_so_as_sent': True,
'default_composition_mode': 'comment',
'force_email': True,
'to':joined_partner,
'cc_recipient_ids':cc,
}


and in template:


${ctx.get('cc_recipient_ids') or 0}

the cc_recipient_ids is the many2many field


Avatar
Discard
Best Answer

Hello Utsav Mallik,
As per your code.
make sure CC is list of id.
Please try this.
ctx={
----
'cc_recipient_ids':[(6,0,CC)],
}

In template

${ctx.get('cc_recipient_ids') or []}

Thanks

Regards,





Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari



Avatar
Discard
Author Best Answer

@Jainesh Shah, I tried your suggestions but it is stil showing value error


Avatar
Discard
Related Posts Replies Views Activity
1
Jul 20
4247
1
May 20
2871
1
Feb 24
836
2
Sep 23
2103
0
Jul 24
1501