← Back to team overview

openerp-india team mailing list archive

[Bug 892273] Re: fetchmail mail_gateway don't accept attachment 6.0.3

 

I continue mi investigation...

  In the script fetchmail.py 
the object email_server in the method fetch_mail
call process_email.
  
in the script mail_gateway.py 
the object mailgate_tool in the method process_email

we have the code

...
	if not len(res_ids):
            new_res_id, attachment_ids = create_record(msg)           # FIRST CREATE ??
            res_ids = [new_res_id]

        # Store messages                                                                                                                                                                                          
        context.update({'model' : model})
        if hasattr(model_pool, 'history'):
            model_pool.history(cr, uid, res_ids, _('receive'), history=True,
                            subject = msg.get('subject'),
                            email = msg.get('to'),
                            details = msg.get('body'),
                            email_from = msg.get('from'),
                            email_cc = msg.get('cc'),
                            message_id = msg.get('message-id'),
                            references = msg.get('references', False) or msg.get('in-reply-to', False),
                            attach = attachments.items(),
                            email_date = msg.get('date'),
                            context = context)                                  # SECOND CREATE
...

create_record(msg) create an instance of crm.lead. and ir.attachment(s)
and history part try to make a second one, and it's didn't works.
It's could be the explain of this bug.

the methode history of the object mailgate_thread

in the object mailgate_thread the method try to do

attachments.append(att_obj.create(cr, uid,
{'res_model':case._name,'res_id':case.id,'name': att[0], 'datas':
base64.encodestring(att[1])}))

and it's rejeted
Error occurred while validating the field(s) name,parent_id,res_model,res_id: File name must be unique!
with name,parent_id,res_model,res_id =>toto.txt 1 crm.lead 85

before and after run the test, in sql : 
 select * from crm_lead;
select * from ir_attachment;
show there is nothing created for toto.txt ...

In create_record :
create ir attachement {'partner_id': False, 'description': 'Mail attachment', 'res_model': 'crm.lead', 'parent_id': 1, 'datas_fname': 'toto.txt', 'file_size': 13, 'res_id': 85L, 'datas': 'dG90b3RvdG8K\n', 'name': 'toto.txt'}

In history :
create ir attachement {'name': 'toto.txt', 'res_model': 'crm.lead', 'parent_id': 1, 'res_id': 85L, 'file_size': 13, 'partner_id': False, 'datas': 'dG90b3RvdG8K\n'}

=> bug !!!

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/892273

Title:
  fetchmail mail_gateway don't accept attachment 6.0.3

Status in OpenERP Server:
  New

Bug description:
  Openerp 6.0.3. Module Fetchmail.

    It's working when I send a simple mail.
  my mail is fetched.
    When my mail have an attachment.
  It's fail with this message.
  WARNING:pop:[02]: Error occurred while validating the field(s) name,parent_id,res_model,res_id: File name must be unique!

    In the code it's the line in mail_gateway/mail_gateway.py
  attachments.append(att_obj.create(cr, uid, {'res_model':case._name,'res_id':case.id,'name': att[0], 'datas': base64.encodestring(att[1])}))
  that's don't work... the name att[0] seem correct...
  I need another module for that's work ? or a config ?

    Module installed :
  base
  base_action_rule
  base_calendar
  base_setup
  board
  crm
  document
  document_webdav
  fetchmail
  knowledge
  mail_gateway
  process
  resource
  web_livechat

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


References