Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Set default send mail template

By
Nicholas Hamilton
on 3/4/16, 5:23 PM 1,040 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.

1

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
2993
| 3 2 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 3/4/16, 6:32 PM

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





How do you do that?

Nicholas Hamilton
on 3/4/16, 6:38 PM

Answeer updated

Jérémy Kersten (jke)
on 3/5/16, 4:24 AM

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

Nicholas Hamilton
on 3/5/16, 7:38 AM

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

Jérémy Kersten (jke)
on 3/5/16, 12:09 PM

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).

Nicholas Hamilton
on 3/5/16, 5:13 PM

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

Jérémy Kersten (jke)
on 3/5/16, 5:17 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 3/4/16, 5:23 PM
Seen: 1040 times
Last updated: 3/5/16, 12:10 PM