It is currently Sat Feb 11, 2012 8:05 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How to access a specific field using "domain"?
PostPosted: Thu Mar 11, 2010 6:33 pm 
Offline

Joined: Mon Sep 14, 2009 10:16 pm
Posts: 35
Location: Montréal, Québec, Canada
I have a custom field I added in the product.category table named "flag". Each of my product categories have a flag. In some product search fields, I wish to restrain the product categories to this given flag.

I know how to restrict the product category by using the category name:

Code:
<field name="product_id" select="1" domain="[('categ_id','=','NameABC')]"/>


But how can I extend this domain syntax to have access to the flag field I created in the product.category table? I'm looking for something like:

Code:
<field name="product_id" select="1" domain="[('categ_id.flag','=','FlagName')]"/>


But this doesn't work. Anybody can help me? Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2010 3:05 am 
Offline

Joined: Mon Sep 14, 2009 10:16 pm
Posts: 35
Location: Montréal, Québec, Canada
I thought my question was pretty straightforward and easy to reply. Has anyone stumble across that kind of issue?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 13, 2010 10:46 am 
Offline

Joined: Tue Mar 17, 2009 8:07 pm
Posts: 47
Location: Greece
add a new related field to product.product:

Code:
'flag' : fields.related ('categ_id','flag',type='char',string='flag'),


and check this field in domain:
Code:
field name="product_id" select="1" domain="[('flag','=','FlagName')]"


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2010 4:54 pm 
Offline

Joined: Mon Sep 14, 2009 10:16 pm
Posts: 35
Location: Montréal, Québec, Canada
Works like a charm. Thanks a lot! :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP