Isn't attached the correct report

Bug #435708 reported by Hugo Santos (Factorlibre)
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Power Email
Fix Released
High
Sharoon Thomas http://openlabs.co.in

Bug Description

I made a email template for sale orders with the report attached. When I send for example the SO0015 sale I received the report
of SO001 sale, if i send the email again I receive the report of sale SO002.

Finally I fix the bug modifing the code of poweremail_send_wizard.py

I modified the function save_to_mailbox because I think that the id that is passed to generate the report was the id of email that has been sent. So I modified the code for generate the report with the id of the document that calls the wizard to send the email. I also modified the line that puts the name of the report and the name of the attached file. The code from the if self.template.report_template is:

if self.template.report_template:
                report_id = screen_vals['rel_model_ref'] #The correct report id
                reportname = 'report.' + self.pool.get('ir.actions.report.xml').read(cr,uid,self.template.report_template.id,['report_name'])['report_name']
                service = netsvc.LocalService(reportname)
                (result, format) = service.create(cr, uid, [report_id], {}, {})
                att_obj = self.pool.get('ir.attachment')
                new_att_vals={
                                'name':screen_vals['report'] + ' (Email Attachment)',
                                'datas':base64.b64encode(result),
                                'datas_fname':unicode(screen_vals['report'] or 'Report') + "." + format,
                                'description':screen_vals['body_text'] or "No Description",
                                'res_model':'poweremail.mailbox',
                                'res_id':mail_id
                                    }
                attid = att_obj.create(cr,uid,new_att_vals)
                if attid:
                    self.pool.get('poweremail.mailbox').write(cr,uid,mail_id,{'pem_attachments_ids':[[6, 0, [attid]]],'mail_type':'multipart/mixed'})

Related branches

Changed in poweremail:
status: New → Fix Committed
Revision history for this message
Sharoon Thomas http://openlabs.co.in (sharoonthomas) wrote :

Can you check and revert, your changes have been committed into the latest trunk.

Changed in poweremail:
assignee: nobody → Sharoon Thomas (openlabs.co.in) (sharoonthomas)
importance: Undecided → High
milestone: none → 0.7
status: Fix Committed → Fix Released
Revision history for this message
叶华 (conqweal) wrote :

multipart/mixed,in the source code ,i have not seen any deal for email type 'multipart/mixed',any solution ?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.