Hello, I have a M2O on the production outputs (stock.move) to sale.line, I’m trying to extend the sale_supply_production.act_production_form
domain but It’s giving me to many values to unpack:
The domain
that causes the crash on model/fields/field.py", line 400
is: ('id', '=', 2328, 'sale.line')
File "/home/vant/Documentos/GitLab/XXXX/.venv/lib/python3.8/site-packages/trytond/model/modelsql.py", line 1447, in convert
expression = field.convert_domain(domain, tables, cls)
File "/home/vant/Documentos/GitLab/XXXX/.venv/lib/python3.8/site-packages/trytond/model/fields/field.py", line 400, in convert_domain
name, operator, value = domain
ValueError: too many values to unpack (expected 3)
<record model="ir.action.act_window" id="sale_supply_production.act_production_form">
<field name="active" eval="False"/>
</record>
<record model="ir.action.act_window" id="act_production_form">
<field name="name">Productions</field>
<field name="res_model">production</field>
<field
name="domain"
eval="
[
If(Eval('active_ids', []) == [Eval('active_id')],
['OR',
[
('origin.sale.id', '=', Eval('active_id'), 'sale.line')
],
[
('outputs.sale_line.sale.id', '=', Eval('active_id'))
]
],
['OR',
[
('origin.sale.id', 'in', Eval('active_ids', []), 'sale.line')
],[
('outputs.sale_line.sale.id', 'in', Eval('active_ids', []))
]
]
)
]"
pyson="1"/>
</record>
<record model="ir.action.keyword" id="act_production_form_keyword1">
<field name="keyword">form_relate</field>
<field name="model">sale.sale,-1</field>
<field name="action" ref="act_production_form"/>
</record>
I tried to check the or conditions on console and all seams to work okey (expected results are okey, 3 productions):
Tryton 6.0.1, Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
>>> Production = pool.get('production')
>>> domain = ['OR',
... [('origin.sale.id', 'in', [2328], 'sale.line')],
... [('outputs.sale_line.sale.id', 'in', [2328])]]
>>> Production.search(domain)
[Pool().get('production')(832), Pool().get('production')(830), Pool().get('production')(831)]
>>> domain =['OR',
... [('origin.sale.id', '=', 2328, 'sale.line')],
... [('outputs.sale_line.sale.id', '=', 2328)]]
>>> Production.search(domain)
[Pool().get('production')(832), Pool().get('production')(830), Pool().get('production')(831)]
>>>
Can anyone help to point what the hell I’m doing wrong?
Huge thanks!