Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

ODOO 8.0 error in ubuntu MissingError One of the documents you are trying to access has been deleted, please try again after refreshing.

By
fisher
on 12/18/14, 12:01 AM 3,485 views

when use email template to send mail, there is error in ubuntu but no in windows 7 (development)

source code as following

 res = super(kanban_OrderTracking, self).create(vals)

if not is_production_order_available and res.workstation.planners.ids:
            obj_email_template = self.env['email.template']
            email_template = obj_email_template.search([('name', '=', 'no order for new kanban')], limit=1)
            if email_template:
                partner_to = reduce(lambda x, y: str(x) + ',' + str(y), res.workstation.planners.ids)
                email_template.write({'partner_to': partner_to})
                self.env.invalidate_all()
                email_template.send_mail(res.id, force_send=True)

server logs

Traceback (most recent call last):
  File "/data/odoo/openerp/http.py", line 517, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/data/odoo/openerp/http.py", line 538, in dispatch
    result = self._call_function(**self.params)
  File "/data/odoo/openerp/http.py", line 294, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/data/odoo/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/data/odoo/openerp/http.py", line 291, in checked_call
    return self.endpoint(*a, **kw)
  File "/data/odoo/openerp/http.py", line 754, in __call__
    return self.method(*args, **kw)
  File "/data/odoo/openerp/http.py", line 387, in response_wrap
    response = f(*args, **kw)
  File "/data/odoo/addons/web/controllers/main.py", line 949, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/data/odoo/addons/web/controllers/main.py", line 941, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/data/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/data/odoo/openerp/api.py", line 391, in old_api
    result = new_api(recs, *args, **kwargs)
  File "/data/odoo/openerp/api.py", line 395, in new_api
    result = [method(rec, *args, **kwargs) for rec in self]
  File "/data/odoo/addons/ssmr_kanban/ssmr_kanban.py", line 73, in write
    obj_ordertracking.create({'workstation': self.id, 'stage': 'wait'})
  File "/data/odoo/openerp/api.py", line 235, in wrapper
    return new_api(self, *args, **kwargs)
  File "/data/odoo/addons/ssmr_kanban/ssmr_kanban.py", line 678, in create
    email_template.send_mail(res.id, force_send=True)
  File "/data/odoo/openerp/api.py", line 235, in wrapper
    return new_api(self, *args, **kwargs)
  File "/data/odoo/openerp/api.py", line 507, in new_api
    result = [method(self._model, cr, uid, id, *args, **kwargs) for id in self.ids]
  File "/data/odoo/addons/email_template/email_template.py", line 556, in send_mail
    msg_id = mail_mail.create(cr, uid, values, context=context)
  File "/data/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/data/odoo/addons/fetchmail/fetchmail.py", line 298, in create
    res = super(mail_mail, self).create(cr, uid, values, context=context)
  File "/data/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/data/odoo/addons/mail/mail_mail.py", line 84, in create
    return super(mail_mail, self).create(cr, uid, values, context=context)
  File "/data/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/data/odoo/openerp/api.py", line 332, in old_api
    result = method(recs, *args, **kwargs)
  File "/data/odoo/openerp/models.py", line 3994, in create
    record = self.browse(self._create(old_vals))
  File "/data/odoo/openerp/api.py", line 235, in wrapper
    return new_api(self, *args, **kwargs)
  File "/data/odoo/openerp/api.py", line 464, in new_api
    result = method(self._model, cr, uid, *args, **kwargs)
  File "/data/odoo/openerp/models.py", line 4050, in _create
    record_id = self.pool[table].create(cr, user, tocreate[table], context=context)
  File "/data/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/data/odoo/addons/mail/mail_message.py", line 802, in create
    values['record_name'] = self._get_record_name(cr, uid, values, context=context)
  File "/data/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/data/odoo/addons/mail/mail_message.py", line 772, in _get_record_name
    return self.pool[values['model']].name_get(cr, SUPERUSER_ID, [values['res_id']], context=context)[0][1]
  File "/data/odoo/openerp/api.py", line 237, in wrapper
    return old_api(self, *args, **kwargs)
  File "/data/odoo/openerp/api.py", line 360, in old_api
    result = method(recs, *args, **kwargs)
  File "/data/odoo/openerp/models.py", line 1669, in name_get
    result.append((record.id, convert(record[name])))
  File "/data/odoo/openerp/models.py", line 5486, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/data/odoo/openerp/fields.py", line 764, in __get__
    return record._cache[self]
  File "/data/odoo/openerp/models.py", line 5820, in __getitem__
    return value.get() if isinstance(value, SpecialValue) else value
  File "/data/odoo/openerp/fields.py", line 53, in get
    raise self.exception
MissingError: ('MissingError', u'One of the documents you are trying to access has been deleted, please try again after refreshing.')

1
Harsh Dhaduk
On 12/18/14, 1:42 AM

Hi Fisher,

This error generaly comes when id not found like user write, remove or fetch data using not existing id.

Thanks,
Harsh Dhaduk

the problem is that the same code runs well in windows 7, but not in ubuntu!

fisher
on 12/18/14, 1:48 AM
0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 12/18/14, 1:04 AM

It has nothing to do with OS, I believe.  Can you check whether you have Email Template whose name is 'no order for new kanban' (exactly like that, with no extra spaces, without the quote).  If you don't, there's the problem.  Because you are searching Email Template using that name.  A better way is to search via XML ID instead of searching by name.

the email template is there which is checked by the line if email_template, actually the error is caused byt he send_mail statement.

fisher
on 12/18/14, 1:46 AM
0
fisher
On 12/19/14, 2:02 AM

I failed fixing the problem , but eventually changed to the automated action approach, here attached the working code in the automated action "execute python code" ( it seems in automated action, new API is not supported, so adapted to old API )

obj_email_template = pool.get('email.template')
email_template = obj_email_template.search(cr,uid,[('name', '=', 'no_order_available')], context=context,limit=1)
if email_template:
    email_template = obj_email_template.browse(cr,uid,email_template,context=context)
    email_to = ''
    email_to = reduce(lambda x, y: x + ',' + y.email if (x) else y.email, object.workstation.planners,email_to)
    if email_to:   # use ' instead of " to quote, otherwise there will be no column exist error!
        cr.execute("""UPDATE email_template SET email_to = '%s' where id = %s"""%(email_to, email_template.id))
        email_template.send_mail(object.id, force_send=True)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/18/14, 12:01 AM
Seen: 3485 times
Last updated: 3/16/15, 8:10 AM