← Back to team overview

openerp-india team mailing list archive

[Bug 1031694] Re: Incoming Mail with attachment error

 

Hello inglorious ,
I have checked this issue with trunk as well as 6.1

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

Title:
  Incoming Mail with attachment error

Status in OpenERP Addons (modules):
  Confirmed

Bug description:
  Hi,

  I have installed the stable server build openerp-6.1-20120726-233351
  on ubuntu 10.04 LTS and ubuntu 12.04 LTS. If I setup an incoming
  googlemail server, it works, and the mails are fetched correctly. But
  if an E-Mail has an attachment, I got the following error:

  ================================= Begin Code:
  ==================================

  2012-08-01 09:50:27,015 7409 ERROR ? fetchmail: Failed to fetch mail from pop server XEO Order Test
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/fetchmail/fetchmail.py", line 220, in fetch_mail
      context=context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/mail/mail_thread.py", line 426, in message_process
      res_id = create_record(msg)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/mail/mail_thread.py", line 400, in create_record
      context=context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/mail/mail_thread.py", line 173, in message_new
      self.message_append_dict(cr, uid, [res_id], msg_dict, context=context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/mail/mail_thread.py", line 344, in message_append_dict
      context = context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/mail/mail_thread.py", line 263, in message_append
      to_attach.append(ir_attachment.create(cr, uid, data_attach, context=context))
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/base_calendar/base_calendar.py", line 1633, in create
      return super(ir_attachment, self).create(cr, uid, vals, context=context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/base/ir/ir_attachment.py", line 117, in create
      return super(ir_attachment, self).create(cr, uid, values, context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/osv/orm.py", line 4239, in create
      self.pool.get(object)._store_set_values(cr, user, ids, fields2, context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/osv/orm.py", line 4388, in _store_set_values
      result = self._columns[f].get(cr, self, ids, f, SUPERUSER_ID, context=context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/osv/fields.py", line 1129, in get
      result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/addons/base/ir/ir_attachment.py", line 132, in _name_get_resname
      res = model_pool.name_get(cr,uid,[res_id],context)
    File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120726_233351-py2.7.egg/openerp/osv/orm.py", line 2262, in name_get
      [self._rec_name], context, load='_classic_write')]
  KeyError: 'name'

  ============================ / End Code =============================

  As you see, the exception is thrown at 132 int ir_attachment.py:

                   model_pool = self.pool.get(model_object)
                    res = model_pool.name_get(cr,uid,[res_id],context)
                   res_name = res and res[0][1] or False

  If the exception is thrown, the test res_name wont be reached. I made
  a try-catch block.

  
  129                 model_pool = self.pool.get(model_object)
  130                 # inglorious, 1.8.12
  131                 try:
  132                     res = model_pool.name_get(cr,uid,[res_id],context)
  133                 except Exception, e:
  134                     res = False
  135 
  136                 res_name = res and res[0][1] or False

  If the exception is thrown, res will be set to false. The solution
  works for me.

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


References