Hello,
I'am using Odoo 10, an I want to send mails to customers, but when I choose the email template I get this warning:
Failed to render template <Template memory:7f6ef3136b50> using values {'format_tz': <function <lambda> at 0x7f6ef3cdbd70>, 'format_date': <function <lambda> at 0x7f6ef3cdb938>, 'ctx': {u'lang': u'en_US', u'tz': False, u'uid': 1, u'active_model': u'account.invoice', u'params': {u'action': 251}, u'search_disable_custom_filters': True, u'active_ids': [2], 'tpl_partners_only': True, u'active_id': 2}, 'user': res.users(1,), 'object': None}
Despite that I send mails when I click in the button Validate.
This is my python code:
class AccountInvoiceBymail(models.TransientModel):
_name = 'account.voucher.bymail'
_inherit = 'mail.compose.message'
@api.model
def invoice_selection(self):
return self.env['account.invoice'].browse(self._context.get('active_ids'))
@api.multi
def send_mail_invoice(self):
for invoice in self.invoice_ids:
if (invoice.email and invoice.state != 'draft'):
template = self.template_id template.send_mail(invoice.id, force_send=True) invoice.write({'mail_sent': True})
invoice_ids = fields.Many2many('account.invoice', default=invoice_selection)
And this is my xml code:
<field name="template_id" domain="[('model','=','account.invoice')]" widget="selection"/>
Knowing that it works perfectly under odoo 8.
Thank you.
Best regards
what error does it shows in log file ?