Hi Everybody
We've ran into the following issue:
Invoice App:
We added a many2many field (additional_recipients) in our invoice app (account.move). It is filled from a similar field in res.partner, which contains the additional contacts for each partner.
The goal is, that invoices are automatically sent to the contacts, selected in this field.
Mail Template:
The field partner_to in the mail.template, now has the following value:
{{ object.partner_id.id }}, {{ object.additional_recipients.id }}
Error Messages:
In case the there are no additional contacts, the mail template runs into a value error because there is no ID from which it would get an email-address
ValueError: invalid literal for int() with base 10: ' '
In case there are multiple contacts selected, it runs into an error because the partner_to field expects singleton expressions. Meaning, that it works as long as there is only one contact in the field.
Failed to render inline_template template : : "Expected singleton: res.partner(2728, 3374)" while evaluating' object.additional_recipients.id ')
Do you have an idea how to fix this issue without coding too much?
Kind regards, and thank you in advance!