← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 435708] Re: Isn't attached the correct report

 

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

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/435708

Title:
  Isn't attached the correct report

Status in Power e-Mail for Open ERP:
  Fix Released

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'})