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

Why Filter causes Uncaught Error: Expected ")", got "(string)" error?

By
E.R. Spada II
on 3/1/14, 2:23 PM 1,304 views

I have a filter on the sales_order_line so it only shows uom, po_uom, uos, so users do not select a uom that we do not sell. After updating Openerp server/web in Jan. This has always worked in the past.

When the use edits the existing quotation on the sales order line, when you click on the UOM bang: Uncaught Error: Expected ")", got "(string)" web/static/lib/py.js/lib/py.js:361

Not sure why this stopped working. Here is the py for the function and the XML:

class product_uom(osv.Model): _inherit = "product.uom"

def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
    if context.get('product_id'):
        product = self.pool.get('product.product').browse(cr, uid, context['product_id'])
        uom_id = [product.uom_id.id, product.uom_po_id.id]
        if product.uos_id:
            uom_id.append(product.uos_id.id)
        ref_unit =  self.search(cr, uid, [('category_id', '=', product.uom_id.category_id.id), ('uom_type', '=', 'reference')])
        if ref_unit:
            uom_id.append(ref_unit[0])
        args.append(('id', 'in', uom_id))
        print args
    return super(product_uom, self).name_search(cr, uid, name, args=args, operator=operator, context=context, limit=limit)

<xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/div[@groups='product.group_uos']/field[@name='product_uos']" position="attributes"> <attribute name="domain" >['|','|',('id','=",product.uom_id),(" id','=",product.uos_id" ),('id','=",product.uom_po_id)]</attribute> <attribute name="context">{" product_id':product_id}<="" attribute=""> </xpath> <xpath expr="//page[@string='Order Lines']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='product_uos']" position="attributes"> <attribute name="domain" >['|','|',('id','=",product.uom_id),(" id','=",product.uos_id" ),('id','=",product.uom_po_id)]</attribute> <attribute name="context">{" product_id':product_id}<="" attribute=""> </xpath>

           <xpath expr="//page[@string='Order Lines']/field[@name='order_line']/form[@string='Sales Order Lines']/group/group/div/field[@name='product_uom']" position="attributes">
                <attribute name="domain" >['|','|',('id','=',product.uom_id),('id','=',product.uos_id'),('id','=',product.uom_po_id)]</attribute>
                <attribute name="context">{'product_id':product_id}</attribute>
           </xpath>
           <xpath expr="//page[@string='Order Lines']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='product_uom']" position="attributes">
                <attribute name="domain" >['|','|',('id','=',product.uom_id),('id','=',product.uos_id'),('id','=',product.uom_po_id)]</attribute>
                <attribute name="context">{'product_id':product_id}</attribute>
            </xpath>

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: 3/1/14, 2:23 PM
Seen: 1304 times
Last updated: 3/16/15, 8:10 AM