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: browse_record(label.maker, 1) is not JSON serializable

By
kaynis
on 9/2/13, 1:21 PM 2,510 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'),


}
       label_maker()

       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'),
}
       product_product()

       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

    sale_order_line()

   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>
            <xpath expr="//field[@name='order_line']/form/notebook/page[@string='Order Line']//field[@name='product_uom_qty' ]" position="before">
                <field name="order_line_label" />

            </xpath>
        </field>
    </record>
2
le_dilem
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

kaynis
on 9/3/13, 10:06 AM

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

kaynis
on 9/3/13, 10:12 AM

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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