Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Tryton Tryton
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 792
    • Issues 792
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 85
    • Merge requests 85
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Tryton
  • TrytonTryton
  • Issues
  • #12016
Closed
Open
Created Jan 17, 2023 by Raimon Esteve@resteve

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 Jan 17, 2023 by Cédric Krier
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking