Hello everyone.
I created a form widget, which has a button that executes a model python function then call a window action to show another form.
The button javascript code is like this :
validate: function(solution_id)
{
var self = this;
var model = new instance.web.Model("mod.flight.result");
model.call("confirm_selection", [solution_id]).then(function(result){
if (result == false){
alert("Error");
}
else{
var action = {
type: 'ir.actions.act_window',
res_model: 'mod.flight',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'current',
res_id: result
};
// self.do_action accepts the action parameter and opens the new view
self.do_action(action);
}
});
},
My function on the server returns the id of the element I want to show.
My issue is that when I call the self.do_action() function, I get the error :
Traceback (most recent call last):
File "/home/pj/dev/b2b-8/server/openerp/http.py", line 362, in dispatch
response["result"] = self._call_function(**self.params)
File "/home/pj/dev/b2b-8/server/openerp/http.py", line 223, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/pj/dev/b2b-8/server/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/home/pj/dev/b2b-8/server/openerp/http.py", line 220, in checked_call
return self.endpoint(*a, **kw)
File "/home/pj/dev/b2b-8/server/openerp/http.py", line 559, in __call__
return self.method(*args, **kw)
File "/home/pj/dev/b2b-8/server/openerp/http.py", line 266, in response_wrap
response = f(*args, **kw)
File "/home/pj/dev/b2b-8/server/openerp/addons/web/controllers/main.py", line 1226, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/pj/dev/b2b-8/server/openerp/addons/web/controllers/main.py", line 1207, in _call_kw
names = dict(request.session.model(model).name_get(args[0], **kwargs))
File "/home/pj/dev/b2b-8/server/openerp/http.py", line 656, in proxy
result = meth(cr, request.uid, *args, **kw)
File "/home/pj/dev/b2b-8/server/openerp/osv/orm.py", line 1978, in name_get
load='_classic_write', context=context)]
File "/home/pj/dev/b2b-8/server/openerp/osv/orm.py", line 3279, in read
select = map(lambda x: isinstance(x, dict) and x['id'] or x, select)
File "/home/pj/dev/b2b-8/server/openerp/osv/orm.py", line 3279, in <lambda>
select = map(lambda x: isinstance(x, dict) and x['id'] or x, select)
KeyError: 'id'
I really don't know where do this error comes from. My action seems to be well formatted, my res_id value is correct. Don't have any clue..
Any idea about this error ?
I'm working on the trunk version of openerp by the way (version 8).
Thank you !