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.

1

Show tree view in form OpenERP

By
Saghir A. Khatri
on 2/20/15, 6:32 AM 1,293 views

I have a scenario. I have a form view which only has a many2one field called users which shows all the products assigned to the user selected. Currently it is working. My Existing xml view is like this

<record id="person_search_form_view" model="ir.ui.view">

     <field name="name">person.search</field>

     <field name="model">person.search</field>

     <field eval="7" name="priority"/>

     <field name="arch" type="xml">

        <form string="FORM DATA" version="7.0" >

            <field name="users"/>

            <button name="person_views" string="View" type="object" />

        </form>

    </field>

</record>

my button click code is like this:

def person_views(self,cr,uid,ids,context):

    domain=[]

    for id in ids:

        person_obj=self.pool.get('person.search').browse(cr,uid,id)

    per = int(person_obj.users)

    if per != False:

        query="select id,name from product_product where issue_to_equip="+str(per)+" OR assigned_to_it = "+str(per)+" OR assigned_to_soft = "+str(per)+" OR issue_to_book = "+str(per)+" OR person_phone ="+str(per)+" OR driver_vehicle = "+str(per)

    cr.execute(query)

    result=cr.fetchall()

    for p_id,name in result:

        domain.append((p_id))

return { 'type': 'ir.actions.act_window', 'res_model': 'product.product', 'view_type': 'form', 'view_mode': 'tree,form', 'target': 'current', 'context':ctx, 'domain':[('id','in',domain)] }

In this scenario products are being shown but on another page. My requirement is to show filtered values on same page and if user chagnes drop down, tree view also updates on button click. Is this possible in OpenERP7. Any hint to proper direction is appreciated. Thanks.

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

1 follower(s)

Stats

Asked: 2/20/15, 6:32 AM
Seen: 1293 times
Last updated: 7/28/16, 3:49 AM