Hi,
in function you call by pushing your button, when you call method send_mail of model email_template ((module email_template), add in context all informations you need to build your pdf and id of the email in a list with key 'add_pdf': [email_id, 'file_name.pdf', ....]. for function parameter 'force_send' set value True, then the method send of mail_mail model module mail) will be called by inheriting the context.
In this function, variable attachments contains files to send with code:
# load attachment binary data with a separate read(), as prefetching all
# `datas` (binary field) could bloat the browse cache, triggerring
# soft/hard mem limits with temporary data.
attachment_ids = [a.id for a in mail.attachment_ids]
attachments = [(a['datas_fname'], base64.b64decode(a['datas']))
for a in ir_attachment.read(cr, SUPERUSER_ID, attachment_ids,
['datas_fname', 'datas'])]
you should override after this code in your module by overriding method send:
+ test if key 'add_pdf' is in the context
+ if yes test email_id of the key 'add_pdf' with current email_id of function send of the for loop.
+ if yes, call your function which genarates your pdf using informations you have in key 'add_pdf' and had tuple ('file_name.pdf', file) to the variable attachments list
bye
Hi,do you use a template to send email ? Secondly, does your pdf is store in attachment or dynamically from where and how? bye