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

How to attach a pdf and send mail on click of button in openerp 7.0

By
Maniganda
on 11/21/13, 11:26 PM 3,300 views

I need to add pdf as an attachment and send mail to partner on click of customised button in form openerp 7.0 , how to achieve this scenario

Where you want this?

Remya
on 11/22/13, 12:19 AM

in sale_order i have created a button called approve contract, on click of this button i should attach the pdf for the template and send the mail to the partner

Maniganda
on 11/22/13, 12:40 AM
0
Prajul P T
On 11/22/13, 1:04 AM

In OpenERP 7.0 Quotation, there is a button called "Send By Email" which when clicked opens the related template of sale order. From here you can send the Quotation to the partner. We can also specify the report to be attached with this mail in the template ie; in Settings > Email > Email Template, in tab "Advanced", there is a field called "Optional report to print and attach". You can specify the report to attach with the mail in this field. If you want to add the functionality to send the mail automatically from your button action, you can call function send_mail in email.template model which sends the mail for the record using the template specified as arguments.

self.pool.get('email.template').send_mail(cr, uid, template_id, record_id, force_send=True, context=context)

where template_id is the id of the template to use to send the mail, record_id is the id of the record in your case sale order id, force_send which when set true will send the mail instantaneously without queuing the mail in the email queue manager.

Thanks for your reply, but in my case i am opening and wizard for this operation, onclick of button directly the template and pdf has to be sent for the partner, how this can be achieved

Maniganda
on 11/22/13, 1:55 AM

So the button to send the mail is in your wizard??

Zesty Beanz Technologies, Prajul P T
on 11/22/13, 1:57 AM

no the button is similar to send_mail button in sale_order, i have created as approve contract ,onclick of this button then a am able to send the template automatically but for that template i need to atach the report for this template

Maniganda
on 11/22/13, 2:01 AM

In template in location Settings > Email > Templates, there is a tab called "Advanced". In this tab there is a field called "Optional report to print and attach". You can specify the report you want to attach i this field.

Zesty Beanz Technologies, Prajul P T
on 11/22/13, 2:06 AM

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

0 follower(s)

Stats

Asked: 11/21/13, 11:26 PM
Seen: 3300 times
Last updated: 3/16/15, 8:10 AM