← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 791537] Re: V6.0.2: fetchmail-module can\'t import mail with attachements

 

I 've found the same problem using an Gmail account.

The problem is related to a duplicated name in an attachment. In the case of
GMAIL, there is the possibility to receive for example your signing (when it
comes with an image) once as part of the text and once as attachment.

This duplicated name is not allowed in the module 'document', and thus
raises an exception.


I don't know why, but the information associated to the exception is lost,
and nothing but the useless 'ValidityError' string is shown. This is
probably another bug


The solution is to change the file 'mail_gateway.py' on the 'mail_gateway'
module, in the creation of attachments, about line 128 with:


        for case in cases:

            attachments = []

            #NUMA

            seq = 1

            for att in attach:

                #NUMA

                #Ensure no file name is duplicated

                attachments.append(att_obj.create(cr, uid, {'type':'binary',
'res_model':case._name,'res_id':case.id,'name': "[%03d] %s"%(seq,att[0]),
'datas': base64.encodestring(att[1])}))

                seq +=1


            partner_id = hasattr(case, 'partner_id') and (case.partner_id
and case.partner_id.id or False) or False

            if not partner_id and case._name == 'res.partner':

                partner_id = case.id


This simply adds a sequence number to the attachment's name, ensuring no
file will have a duplicated name

I haven't tested very deep, but it seems it works

Cheers


Gustavo Adrian Marino


Mobile: +54 911 5498 2515

Email:  <mailto:gamarino@xxxxxxxxx> gamarino@xxxxxxxxx

Skype: gustavo.adrian.marino

-- 
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/791537

Title:
  V6.0.2: fetchmail-module can't import mail with attachements

Status in OpenERP Modules (addons):
  Confirmed

Bug description:
  when I try to download mails from pop or imap-server with fetchmail
  module everithing works well without attachements. As soon ther is an
  attachement I get the following error:

  [2011-06-01 22:02:58,988][test] INFO:imap:fetchmail start checking for new emails on hostpoint
  [2011-06-01 22:02:59,667][test] WARNING:pop:[01]: warning
  [2011-06-01 22:02:59,667][test] WARNING:pop:[02]: ValidateError

  The attachement is downloaded but the e-mail is not...

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/791537/+subscriptions


Follow ups

References