user3664724
user3664724

Reputation: 357

How to filter domain data python opnerp 7?

how to filter domain data when my xml is,

xml code: <field name="categ_temps" domain="[('parent_id', '=', 1)]" on_change="myProduct_Category_OnChange(categ_temps)" sequence="1"/>

it is getting value App product/phone i want to remove "All product" from it how would i split it?

more over i am using onchange method that is,

python code : def myProduct_Category_OnChange(self,cr,uid,ids,categ_temps):
        pro_id=[]
        if(str(categ_temps)!='False'):
           cr.execute('select id,name from product_category where parent_id='+str(categ_temps))
           res = cr.fetchall()
           for pid,name in res:
              pro_id.append((pid))
              print name
           return {'domain':{'categ_temp2':[('id','in',pro_id)]}}

here i am using query which shows result like this in query analyzer,

 4   phone

but in oboe method it shows in this way,

all product/phone 

why it is getting all product all time how to trim it ?

One more thing domain is set with fields that woulds get data from particular table in which parent id ='1'

table have data in this way so that it would be more clear,

id(pk)     parent id       name  

1                       all product
2             1           phone
3             2           samsung

Hopes for your suggestion thanks in advance

Upvotes: 1

Views: 220

Answers (1)

Quentin THEURET
Quentin THEURET

Reputation: 1232

I think you should see at the method name_get() of the product.category object. It is this method which computes the string displayed for name of product categories.

Upvotes: 1

Related Questions