I have 3 related classes:
The 1st is:
class Note(ModelSQL, ModelView):
'Note'
__name__ = 'ltl.common.note'
date = fields.Date('Date', required=True, states={
'readonly': True
})
note = fields.Text('Note')
@classmethod
def default_date(cls):
return datetime.today()
The 2nd is:
class ProjectNote(ModelSQL, ModelView):
'Project Note'
__name__ = 'ltl.project.note'
project = fields.Many2One('ltl.project', 'Project', required=True)
note = fields.Many2One('ltl.common.note', 'Note', required=True)
The 3rd is:
class Project(ModelSQL, ModelView):
'Project'
__name__ = 'ltl.project'
name = fields.Char('Name', required=True)
remarks = fields.Many2Many('ltl.project.note', 'project', 'note', 'Remarks',
states={
'readonly': Eval('id', -1) < 0
},
depends=['id'],
domain=[
('project', '=', Eval('id'))
]
)
I dunno why, but the domain at remarks field in the 3rd class has cause:
[Mon Aug 25 17:27:29 2025] ERROR:trytond.protocols.dispatcher:ltl.common.note.search([[['project', '=', 1]], ...], 0, 1000, None, {'client': '706d045c-5270-40f...', 'language': 'en', 'language_directio...': 'ltr', 'groups': [1, 4]}) from admin@127.0.0.1/tryton/ in 0 ms [dispatcher.py:253]
Traceback (most recent call last):
File "/home/tryton/project/.env/lib/python3.10/site-packages/trytond/protocols/dispatcher.py", line 216, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/home/tryton/project/.env/lib/python3.10/site-packages/trytond/model/modelsql.py", line 1819, in search
super().search(
File "/home/tryton/project/.env/lib/python3.10/site-packages/trytond/model/modelstorage.py", line 711, in search
check_domain(domain, cls, to_check)
File "/home/tryton/project/.env/lib/python3.10/site-packages/trytond/model/modelstorage.py", line 695, in check_domain
check_domain(d, cls, to_check)
File "/home/tryton/project/.env/lib/python3.10/site-packages/trytond/model/modelstorage.py", line 695, in check_domain
check_domain(d, cls, to_check)
File "/home/tryton/project/.env/lib/python3.10/site-packages/trytond/model/modelstorage.py", line 674, in check_domain
field = cls._fields[local]
KeyError: 'project'
Why is the domain cause error while in ltl.project.note it has project field?
When I take out the domain all are fine, its just listing the un-related notes which I don’t want it.
Bromo