Odoo Help


Odoo 8 API Problem. Not JSON Serializable

Patrick Hofacker
on 10/24/15, 9:14 AM 2,618 views

Hey guys,

i'm trying to solve call a wizard(lets call it wiz2) out of another wizard(call this wiz1), then comfortably change the records of the wiz1-model via the model of wiz2.

My problem ist now that i get errors.. over and over, may one of you is able to help me.

here is my code so far:

The Code of the wiz1:

# -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp import exceptions
class TransferExtension(models.TransientModel):
_inherit = 'stock.transfer_details_items'
def do_enter_serials(self):
#get the reference on new model
wizardmodel = self.env['serial.wizard']
#create new record
res_id = wizardmodel.create({'item_clicked':self.id})
#Read the view_id.
view = self.env.ref('unique_serials_v1.view_serial_wizard')
#call the other wizard
return {
'name': 'Eingabe der Serialnummern',
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'serial.wizard',
'res_id': res_id,
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new'

And this is the code of my wiz2

# -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp import exceptions
class SerialWizard(models.TransientModel):
_name = 'serial.wizard'
item_clicked = fields.Many2one('stock.transfer_details_items',string='Item') 

so i'm getting the error:

Odoo Server Error

Traceback (most recent call last):

File "/opt/odoo/openerp/http.py", line 537, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/opt/odoo/openerp/http.py", line 588, in dispatch

return self._json_response(result)

File "/opt/odoo/openerp/http.py", line 526, in _json_response

body = simplejson.dumps(response)

File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 354, in dumps

return _default_encoder.encode(obj)

File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 262, in encode

chunks = self.iterencode(o, _one_shot=True)

File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 340, in iterencode

return _iterencode(o, 0)

File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line 239, in default

raise TypeError(repr(o) + " is not JSON serializable")

TypeError: serial.wizard(7,) is not JSON serializable


and don't have any idea where the problem is.

Hope you can help me

Thanks in Advance




| 6 5 7
Lodz, Poland

On 10/24/15, 9:55 AM

Documentation new api - method create():

Takes a number of field values, and returns a recordset containing the record created:

>>> self.create({'name': "New Name"})


Conclusion: your problem with res_id

Oh my god... im such an idiot... Many Thanks... take all my upvotes i can give to you. That was the solution

Patrick Hofacker
on 10/24/15, 10:00 AM

If the answer is correct, select rather that you accept it. Additionally, you can possibly vote.

on 10/24/15, 10:07 AM

Sry didn't find the button right away. But now your answer is marked. Thank your very much... im hanging there since 2 weeks

Patrick Hofacker
on 10/24/15, 11:00 AM

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: 10/24/15, 9:14 AM
Seen: 2618 times
Last updated: 10/24/15, 11:00 AM