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.
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
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
|Asked: 2/26/16, 12:46 PM|
|Seen: 579 times|
|Last updated: 3/12/16, 8:24 PM|