Conflict count field in project.work.status and Target.count() in m2o fields
Since 4f5c0ae3fa1 Remove target_search on Many2One, add Target.count()
At project module, model project.work.status, there is field named "count"
Error when try to pass a project tests:
ERROR: test_field_relation_domain (test_module.ProjectPhaseTestCase) (model='project.work', field='parent')
Test domain of relation fields
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tryton/tryton/trytond/trytond/tests/test_tryton.py", line 585, in test_field_relation_domain
Target.search(domain, limit=1)
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1651, in search
tables, expression = cls.__search_query(domain, count, query, order)
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1570, in __search_query
tables, expression = cls.search_domain(domain)
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1788, in search_domain
expression = convert(domain)
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1784, in convert
return And((convert(d) for d in (
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1784, in <genexpr>
return And((convert(d) for d in (
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1777, in convert
return convert(expression)
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1782, in convert
return Or((convert(d) for d in domain[1:]))
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1782, in <genexpr>
return Or((convert(d) for d in domain[1:]))
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1784, in convert
return And((convert(d) for d in (
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1784, in <genexpr>
return And((convert(d) for d in (
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1782, in convert
return Or((convert(d) for d in domain[1:]))
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1782, in <genexpr>
return Or((convert(d) for d in domain[1:]))
File "/tryton/tryton/trytond/trytond/model/modelsql.py", line 1775, in convert
expression = field.convert_domain(domain, tables, cls)
File "/tryton/tryton/trytond/trytond/model/fields/field.py", line 200, in wrapper
return func(*args, **kwargs)
File "/tryton/tryton/trytond/trytond/model/fields/many2one.py", line 262, in convert_domain
if Target.count() < _subquery_threshold:
TypeError: 'Boolean' object is not callable
A debug example:
(Pdb) Party = pool.get('party.party')
(Pdb) Party.count()
0
(Pdb) ProjectWorkStatus = pool.get('project.work.status')
(Pdb) ProjectWorkStatus.count()
*** TypeError: 'Boolean' object is not callable
Edited by Cédric Krier