Hilfe

TypeError: … is not JSON serializable

Closed
Avatar
priyankahdp

The question has been closed

durch
priyankahdp
an 30.04.2013 09:25:49

Here is my error

  File "/usr/share/pyshared/simplejson/encoder.py", line 202, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: browse_record(bpl.division.n.registration, 1) is not JSON serializable

Here is my relation mapping table

class company_estate_division(osv.osv):
    _name = 'bpl.company.estate.division'
    _description = 'bpl company estate division mapping'
    _columns = {
        'bpl_estate_id': fields.many2one('bpl.estate.n.registration', 'Estate', select=True),
        'bpl_division': fields.related('bpl_estate_id', 'divisions', type='char', string='Estate & Division'),
        }

And here shows my division and estate model classes.

class estate_new_registration(osv.osv):
    _name = "bpl.estate.n.registration"
    _description = "Estates"
    _columns = {
        'name': fields.char('Estate Name', size=128, required=True),
        'company_id': fields.many2one('res.company', 'Company Name', select=True),
        'divisions': fields.one2many('bpl.division.n.registration', 'estate_id', 'Division')
    }
class division_new_registration(osv.osv):
    _name = "bpl.division.n.registration"
    _description = "Divisions"
    _columns = {
        'name': fields.char('Division Name', size=128, required=True),
        'estate_id': fields.many2one('bpl.estate.n.registration', 'Estate Name', select=True),
    }

I need to map company to estates. (company one-to-many estates) I think using related fields is easier than others for this mapping. Please help.

Avatar
Verwerfen
1 Antwort
0
Avatar
priyankahdp
Best Answer

I'm going to return object.thatswhy issue occured but then obj.field name given and issue sorted

Avatar
Verwerfen