Odoo Help


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

on 9/2/13, 1:21 PM 3,604 views

When I installed my module it loads but whenever I select a product that has a label type specified for, I get this error and I don't have a clue. I need your help please. Thank you in advance

       class label_maker(osv.osv):
_name = 'label.maker'
_columns = {
    'name': fields.char('Label Name',size=200,required=True, help='This is the name of the label'),
    'label_owner': fields.char('Company Name',size=200,select=True, help='selects the product on the order line'),


       class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
_columns = {
    'order_line_label': fields.many2one('label.maker','Label',select=True, help='label name'),

       class sale_order_line(osv.osv):
_name = 'sale.order.line'
_inherit = 'sale.order.line'
_columns = {
    'order_line_label': fields.many2one('label.maker','Label',select=True, help='select the right label for the product and partner'),


def product_id_change2(self, cr, uid, ids, pricelist, product, qty=0,
        uom=False, qty_uos=0, uos=False, name='', partner_id=False,
        lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, order_line_label=False, context=None):
    context = context or {}

    res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
        uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
        lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)

    product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context)
        #           product_obj = product_obj

    res['value'].update({'order_line_label': product_obj.order_line_label or False})
    return res


   xml am using is

    <record model="ir.ui.view" id="view_order_line_tree">
        <field name="name">order.line.tree</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
            <xpath expr="//page[@string='Sales Order']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='product_uom_qty']" position="before">
                <field name="order_line_label"/>
            <xpath expr="//field[@name='order_line']/form/notebook/page[@string='Order Line']//field[@name='product_uom_qty' ]" position="before">
                <field name="order_line_label" />

On 9/3/13, 7:34 AM

hi when you call a method why you change the name?

def product_id_change( not def product_id_change2

I think we should add id n order_line_label.id

 res['value'].update({'order_line_label': product_obj.order_line_label.id or False}

thanks for your response I will try this and get back to you

on 9/3/13, 10:06 AM

That was it mate. Thank you so much it worked fine.

on 9/3/13, 10:12 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

0 follower(s)


Asked: 9/2/13, 1:21 PM
Seen: 3604 times
Last updated: 3/16/15, 8:10 AM