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

TypeError: unhashable type: 'dict' in wizard - how to debug?

By
Antanas
on 5/21/13, 3:35 AM 3,539 views

Hello,

I have defined a wizard, and cannot find a causo of an error. Please give me a direction. Wizard code:

from osv import osv, fields

class RemoteDbWizard(osv.TransientModel):
    _name = 'remotedb.wizard.fill'
    _columns = {
        'connection_id': fields.many2one(
        'remotedb.remote.connections', 'Connection'),
    }

    def create(self, cr, uid, ids, context=None):
        return {'type': 'ir.actions.act_window_close'}

Wizard connects to this model:

class RemoteConnections(osv.Model):

_name = 'remotedb.remote.connections'
_description = 'Connection data'
_columns = {
    'name': fields.char('Name', size=40),
    'map_ids': fields.many2many('remotedb.table.mapping', 'connections_rel', 'connection_id', 'map_id', 'Connection mapping'),
    'database_id': fields.many2one('remotedb.remote.databases', 'Remote database'),
}

When pushing a button which is defined in wizard view (it calls create method), I am getting:

OpenERP WebClient Error

Client Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130514_231031-py2.7.egg/openerp/addons/web/http.py", line 204, in dispatch
    response["result"] = method(self, **self.params)
  File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130514_231031-py2.7.egg/openerp/addons/web/controllers/main.py", line 1129, in call_kw
    return self._call_kw(req, model, method, args, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/openerp-7.0_20130514_231031-py2.7.egg/openerp/addons/web/controllers/main.py", line 1113, in _call_kw
    names = dict(req.session.model(model).name_get(args[0], **kwargs))
TypeError: unhashable type: 'dict'

What could be wrong here? How could I debug this?

i think the problem is with your create method , in create method you don't have ids

Maniganda
on 5/21/13, 4:10 AM

Can you please elaborate on this? Is this not correct: "def create(self, cr, uid, ids, context=None):"? There is "ids" there...

Antanas
on 5/21/13, 4:13 AM

ya but generally the parameter ids will not appear in create method i.e def create(self, cr, uid, vals, context=None):

Maniganda
on 5/21/13, 4:23 AM

Adjusted code according to your suggestion, but still getting the same error...

Antanas
on 5/21/13, 4:33 AM

can you change the name of create function and call that function in your button

Maniganda
on 5/21/13, 4:51 AM

Renamed function, and no errors any more! Maniganda, thank you very much! Looks like one should be wary of which function names are better not to use!

Antanas
on 5/21/13, 4:57 AM

ya , create is a standard function ,it has be used when ever there is a need or else we should use appropriate function names, if your error fixed then mark it as correct it will be helpfull for others

Maniganda
on 5/21/13, 5:00 AM

Maniganda, if you post your suggestions regarding my problem as an answer (not as a comment), I will be happy to mark your answer as "accepted".

Antanas
on 5/21/13, 5:06 AM
2

Maniganda

--Maniganda--
1038
| 5 7 7
Bangalore, India
--Maniganda--
Maniganda
On 5/21/13, 5:46 AM

Rename your function and call the function in your button, this will solve your issue

In addition to this answer: the cause of the error was a reserved method name, that is "create".

Antanas
on 5/21/13, 5:52 AM

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

0 follower(s)

Stats

Asked: 5/21/13, 3:35 AM
Seen: 3539 times
Last updated: 3/16/15, 8:10 AM