Odoo Help


v7 - type error is not browse_record(product.product, 1) JSON serializable

on 5/14/15, 2:29 AM 1,349 views


i added two fields to sale.view_order_tree

but i resive error :/ do you have please any advice how to fix it ?

type error is not browse_record(product.product, 1) JSON serializable

server log

2015-05-13 13:58:22,815 888 WARNING pokus openerp.osv.orm.browse_record.product.product: Field '_asdict' does not exist in object 'browse_record(product.product, 1)'
2015-05-13 13:58:22,815 888 WARNING pokus openerp.osv.orm.browse_record.product.product: Field '_asdict' does not exist in object 'browse_record(product.product, 1)'
2015-05-13 13:58:22,987 888 INFO pokus werkzeug: - - [13/May/2015 13:58:22] "POST /web/dataset/search_read HTTP/1.1" 500 -
2015-05-13 13:58:23,006 888 ERROR pokus werkzeug: Error on request:
Traceback (most recent call last):
File "werkzeug\serving.py", line 177, in run_wsgi

File "werkzeug\serving.py", line 165, in execute

File "C:\OpenERP 7.0\server\openerp\service\wsgi_server.py", line 417, in application
return application_unproxied(environ, start_response)
File "C:\OpenERP 7.0\server\openerp\service\wsgi_server.py", line 403, in application_unproxied
result = handler(environ, start_response)
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 528, in __call__
return self.dispatch(environ, start_response)
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 487, in __call__
return self.app(environ, start_wrapped)
File "werkzeug\wsgi.py", line 579, in __call__

File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 553, in dispatch
result = handler(request)
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 618, in <lambda>
return lambda request: JsonRequest(request).dispatch(method)
File "C:\OpenERP 7.0\server\openerp\addons\web\http.py", line 251, in dispatch
body = simplejson.dumps(response)
File "simplejson\__init__.py", line 354, in dumps

File "simplejson\encoder.py", line 264, in encode

File "simplejson\encoder.py", line 612, in _iterencode

File "simplejson\encoder.py", line 568, in _iterencode_dict

File "simplejson\encoder.py", line 568, in _iterencode_dict

File "simplejson\encoder.py", line 455, in _iterencode_list

File "simplejson\encoder.py", line 568, in _iterencode_dict

File "simplejson\encoder.py", line 622, in _iterencode

File "simplejson\encoder.py", line 239, in default

TypeError: browse_record(product.product, 1) is not JSON serializable


<?xml version="1.0" encoding="utf-8"?>
<record id="view_sale_inherit_tree" model="ir.ui.view">
<field name="name">sale.inherit.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="arch" type="xml">
<field name="state" position="after">
<field name="product_id"/>
<field name="product_qty"/>


from openerp.osv import fields, osv

class sale_order(osv.osv):
_inherit = 'sale.order'

_columns = {
'product_qty': fields.related('order_line', 'product_uom_qty', type='float', string='Quantity'),
'product_id': fields.related('order_line', 'product_id', type='integer', string='Product'),

thank you so much .-)

on 5/19/15, 8:38 AM

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
Jérémy Kersten (jke)
| 3 2 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 5/19/15, 8:33 AM

order_line.product_id is a browse record...

So, if you really want the id / integer :

 'product_id': fields.related('order_line', 'product_id', 'id', type='integer', string='Product'), 

else if you want the browse record... :

'product_id': fields.related('order_line', 'product_id', type='many2one', relation='product.product', string='Product'),

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 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: 5/14/15, 2:29 AM
Seen: 1349 times
Last updated: 5/19/15, 9:33 AM