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: … is not JSON serializable [Closed]

By
priyankahdp
on 4/24/13, 7:36 AM 6,884 views

The Question has been closed

by
priyankahdp
on 04/30/2013 10: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.

0

priyankahdp

--priyankahdp--
1089
| 5 5 6
Colombo, Sri Lanka
--priyankahdp--
Java Developer ORACLE Python J2EE Spring Hibernate Struts & Jquery............. :-)
priyankahdp
On 4/30/13, 10:25 AM

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

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/24/13, 7:36 AM
Seen: 6884 times
Last updated: 3/16/15, 8:10 AM