Odoo Help


AttributeError: 'dict' object has no attribute 'id'

on 3/24/16, 11:31 PM 3,172 views

I'm trying to use new API in Odoo. (still not quite familiar with it)

I created a module that inherits 'sale.order' object. I added codes in 'action_button_confirm' ('Confirm Sale' button) method that returns wizard if my condition is true, which I want to transfer the codes in create method but I'm getting the error whenever it returns the wizard:

AttributeError: 'dict' object has no attribute 'id'

.py file

class sale_order(models.Model):
_inherit = "sale.order"

    def create(self, vals):
        res = super(sale_order, self).create(vals)
        return self.action_try(res)

    def action_try(self, res):
        for order_id in res:

            if my_condition:
                return {
                'name': 'My wizard',
                'view_mode': 'form',
                'view_type': 'form',
                'res_model': 'my.wizard',
                'type': 'ir.actions.act_window',
                'nodestroy': True,
                'target': 'new',
                'context': {

Other info

Traceback (most recent call last):
  File "/home/workspace/odoo8/openerp/http.py", line 537, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/workspace/odoo8/openerp/http.py", line 574, in dispatch
    result = self._call_function(**self.params)
  File "/home/workspace/odoo8/openerp/http.py", line 310, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/workspace/odoo8/openerp/service/model.py", line 118, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/workspace/odoo8/openerp/http.py", line 307, in checked_call
    return self.endpoint(*a, **kw)
  File "/home/workspace/odoo8/openerp/http.py", line 803, in __call__
    return self.method(*args, **kw)
  File "/home/workspace/odoo8/openerp/http.py", line 403, in response_wrap
    response = f(*args, **kw)
  File "/home/workspace/odoo8/addons/web/controllers/main.py", line 944, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/home/workspace/odoo8/addons/web/controllers/main.py", line 936, in _call_kw
    return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
  File "/home/workspace/odoo8/openerp/api.py", line 268, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/workspace/odoo8/openerp/api.py", line 373, in old_api
    return downgrade(recs, result, *args, **kwargs)
  File "/home/workspace/odoo8/openerp/api.py", line 291, in <lambda>
    return lambda self, *args, **kwargs: downgrade(args[0])
  File "/home/workspace/odoo8/openerp/models.py", line 4049, in <lambda>
    @api.returns('self', lambda value: value.id)
AttributeError: 'dict' object has no attribute 'id'

I didn't include my codes since there's nothing wrong with it (as I check manually), the error only appears when it will return the wizard. How can I return the wizard?


Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 3/25/16, 9:13 PM

You cannot return a wizard dict from the create method. it's not supposed to work like that. If you wanna do it you could put a button for that, all the buttons first will save the data before calling the button action.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/24/16, 11:31 PM
Seen: 3172 times
Last updated: 3/25/16, 9:13 PM