El 21/11/14 a les 21:10, Jordi Esteve (Zikzakmedia) ha escrit:
El 21/11/14 a les 18:35, Sergi Almacellas Abellana ha escrit:
El 21/11/14 a les 18:29, Jordi Esteve (Zikzakmedia) ha escrit:
How can I define a domain that evaluates a reference field?
For example, if you want to create an action keyword to open the stock
moves related to a shipment out, the action window could be:
<record model="ir.action.act_window"
id="act_moves_of_shipment">
<field name="name">Moves</field>
<field name="res_model">stock.move</field>
<field name="domain">[('shipment', '=',
Eval('active_id'))]</field>
</record>
but this does not work because the shipment field in stock moves is a
reference field, so they values are like 'shipment.out,3'. PYSON does
not have any string concatenation operator to join 'shipment.out' with
the Eval('active_id').
Maybe there is other way to solve this issue.
The correct domain is:
[('shipment.id', 'in', Eval('active_ids'), Eval('active_model')]
This does not work because you give 4 parameters in a domain. The
solution that works is the one Cedric has given
Which is correct when joining on a reference field:
http://hg.tryton.org/trytond/file/441615f9b5d7/trytond/model/fields/reference.py#l117
--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk