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.

0

Configuration of more than 1 attachment file (of several kinds) in Email Templates

By
Javier
on 2/26/16, 12:46 PM 722 views

Hello,

I've got a couple of questions related to attaching files in emails using templates:

1. When sending Sale Order by eMail, I am looking for a way to attach to the email more than one files already stored in ir.attachment linked to the SO by a Many2many relation. I see that templates allow me to attach only one file to the mail view by using options in Advance Settings Tab-->Optional report to print and attach. Does anybody knows if it is possible to configure templates to do it, or has an idea on the way I should proceed?

2. Is it possible to instruct templates to attach other kind of files than pdfs or html (i.e. png or xml files)?

Thanks in advance. I appreciate your help.

1

Axel Mendoza

--Axel Mendoza--
10318
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 2/26/16, 8:58 PM

The template it's not restricting you from attach any kind of files, you should be able to do it, but you need to pass more that one attachment to the mail message wizard using the field attachment_ids and the wizard will open with more that one attachment. The email.template model also has the field attachment_ids. You need to intercept the mail compose wizard to add the new attachments, because the sale order report is generated by default using the report template in the template rendering. For that you need to create your version of the Mail Compose Wizard to change the method get_mail_values to add the needed attachments to the mail values return dict so the compose wizard could create the mail.mail with the attachments and convert each of them before send it. Use that new wizard model in the method action_quotation_send of the sale.order as the res_model of the return dict and you will be ok

Thank you for your response Axel. I wil try your suggestion and get back to comment what I will find. Javier

Javier
on 2/26/16, 10:15 PM

Thanks a lot for your guidance Axel. Now everything is working properly.

Javier
on 2/27/16, 9:00 AM

That's worth an accept on the answer then

Axel Mendoza
on 2/27/16, 6:45 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

1 follower(s)

Stats

Asked: 2/26/16, 12:46 PM
Seen: 722 times
Last updated: 3/12/16, 8:24 PM