El 13/06/17 a les 07:24, Khurram Shahzad ha escrit:
Dear All,
I have defined a domain for a filed as follows:
blood_bags = fields.Many2Many('anth.request-bag', 'blood_request',
'blood_bag', 'Blood Bags', required=True,
domain=[('state','=','cross_matched'), ('id', 'in', [1,2])])
Consider condition ('id', 'in', [1,2]) where I have hard-coded values 1
& 2. Is there a way that I can search a model and use the returned list
here dynamically.
If the domain is applied on the field, you should use a One2Many
function field (which will do the compute and return the ids), and use
the following domain:
[('state', '=', 'cross_matched'), ('id', 'in',
Eval('your_function_field', [])]
Having said taht, I'm wondering why you want to use the ids, if you are
going to use a search clause on target model. You can use the '.' to
perform joins domain clauses. For example: Using 'direct_field.name'
will search on the name fields of the records related by the
'direct_field' field. Of course, the direct field must be a relation one.
Hope it helps.
--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk
--
You received this message because you are subscribed to the Google Groups
"tryton" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tryton/c6684e06-0702-d60f-fc59-877f5b176255%40koolpi.com.