Skip to Content
Menu
This question has been flagged
1 Reply
10493 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

Avatar
Discard

Where you want this?

Author

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

Best Answer

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.

Avatar
Discard
Author

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

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

Author

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

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.

Related Posts Replies Views Activity
2
Dec 24
741
1
Dec 24
708
2
Mar 15
9693
4
Mar 15
8054
0
Mar 15
4650