Skip to Content
Menu
This question has been flagged
1 Reply
12444 Views

I recently deleted the default email template for invoice emails, and now when I click on the 'Send by Email' button, an error is thrown:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/8.0/openerp/http.py", line 537, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/8.0/openerp/http.py", line 574, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/src/odoo/8.0/openerp/http.py", line 310, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/src/odoo/8.0/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/src/odoo/8.0/openerp/http.py", line 307, in checked_call
    return self.endpoint(*a, **kw)
  File "/home/odoo/src/odoo/8.0/openerp/http.py", line 803, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/src/odoo/8.0/openerp/http.py", line 403, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/src/odoo/8.0/addons/web/controllers/main.py", line 948, in call_button
    action = self._call_kw(model, method, args, {})
  File "/home/odoo/src/odoo/8.0/addons/web/controllers/main.py", line 936, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/home/odoo/src/odoo/8.0/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/odoo/src/odoo/8.0/addons/portal_sale/portal_sale.py", line 109, in action_invoice_sent
    action_dict = super(account_invoice, self).action_invoice_sent(cr, uid, ids, context=context)
  File "/home/odoo/src/odoo/8.0/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/odoo/src/odoo/8.0/openerp/api.py", line 399, in old_api
    result = method(recs, *args, **kwargs)
  File "/home/odoo/src/odoo/8.0/addons/account/account_invoice.py", line 397, in action_invoice_sent
    default_template_id=template.id,
AttributeError: 'NoneType' object has no attribute 'id'

 Can someone please explain to me, in very precise steps, how I can set a different template as the default.

Avatar
Discard
Best Answer

The code lookin for the template with external Id "account.email_template_edi_invoice"!

so you can just create a ir.model.data which one point to your new template with name account.email_template_edi_invoice

Login in and




active debug to have technical features





 




Create the new email template







 






 


Retrieve the ID in url

/web?&debug=#id=24&view_type=form&model=mail.template&action=168


 Create external id





Avatar
Discard
Author

How do you do that?

Answeer updated

Author

Thanks that worked, although it should be email.template in the model name.

Hi, that depend of your version
since commit d88c34d11e87857a799ecbb0062fe9309858413d, email.template has been renamed into mail.template.
To make simple: you can just take a look in url /web?&debug=#id=24&view_type=form&model=mail.template&action=168

In any case, now you understand how to create a new external Id ... And you are ready to continue your odoo journey :p

Author

What I am a little annoyed about, is I had to create a new external id -- when deleting the template, it seemed to cascade the delete to also remove the external identifier (database probably has foreign key cascade on delete).

Yes, it is and it is normal !
The external id has no sense if there are no record...
What are you trying to do ?