Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I set up a default parameter to load, when i email a quotation. I see it added in my users default parameters, but it still picks nr 5 (portal template) as the default, instead of id:=4.
Any idea on how i can solve this?
Here is our solution to change the default mail template when we click on « send by email » in the sale order form.
- I have changed the view sale.order.form to modify the « send by email » button. I have changed action for action_quotation_send_pt.
- I had created a new method with a new name action_quotation_send_pt method. This method is still in the class sale_order (we inherit sale_order). This method is almost the same than the original action_quotation_send but we will change it soon.
from openerp.osv import osv
_inherit = 'sale.order'
def action_quotation_send_pt(self, cr, uid, ids, context=None):
assert len(ids) == 1, 'This option should only be used for a single id at a time.'
irmodeldataaa = self.pool.get('ir.model.data')
template_id = irmodeldataaa.get_object_reference(cr, uid, 'sale', 'email_template_edi_sale')
template_id = False
compose_form_id = irmodeldataaa.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')
compose_form_id = False ctx = dict()
'views': [(compose_form_id, 'form')],
- We search for the ID of the mail template that we want by default. Here is 24.
- We have changed external identifier record id in sale.email_template_edi_sale. The new record ID is now 24. The id of our default mail template that we want.
- Now, you can see the new « Devis - par courriel », by default, in the « use template » field. It is great!
We are happy!
Here is a working and cleaner solution, I think.
Check out addons/portal_sale/portal_sale.py and search the function action_invoice_sent in the account_invoice class.
If the module portal_sale is installed, this function makes sure the portal version of the email.template for invoices is set dy default.
I just copy pasted this function/class in my module and changed the reference call to point towards my own version.
Hope that helps soemone.
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 platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 8/25/14, 2:52 PM|
|Seen: 5405 times|
|Last updated: 4/16/16, 1:13 AM|