I am developing a Patient Evaluation feature in a Tryton-based system.
Evaluations should appear under the “Evaluations” tab in the xxx.patient
form, but they are not visible.
Models Used:
xxx.patient.evaluation
- Fields:
code
,evaluation_start
,evaluation_endtime
,state
- Many2One relationship to
xxx.patient
xxx.patient
- Field
evaluations
as One2Many toxxx.patient.evaluation
Form XML Code:
I have added the following code in xxx_patient_form.xml
:
<page string="Evaluations">
<field name="evaluations">
<tree editable="bottom">
<field name="code"/>
<field name="evaluation_start"/>
<field name="evaluation_endtime"/>
<field name="state"/>
</tree>
</field>
</page>
However, the data does not appear under the Evaluations tab.
What I Have Tried:
- Checked Access Rights (
ir.model.access
)
xxx.patient.evaluation
has no explicit access rule- I added access for the Health Doctor group, but it still does not appear
- Checked if Data Exists in the Database:
SELECT * FROM xxx_patient_evaluation WHERE patient = (SELECT id FROM xxx_patient WHERE name = 'Suwidarmo');
- This query failed because the
name
field inxxx.patient
is a Many2One toparty.party
, not a direct string. - After correcting it, I confirmed that the data exists in the database, but still does not show up in Tryton.
- Checked the Model Definition in Python (
xxx.patient
)
evaluations = fields.One2Many(
"xxx.patient.evaluation", "patient", "Evaluations",
help="List of medical evaluations associated with this patient."
)
- This looks correct, but the data still does not appear in the UI.
Error occured
Traceback (most recent call last):
File "/trytond/wsgi.py", line 117, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 46, in rpc
return methods.get(request.rpc_method, _dispatch)(
File "/trytond/wsgi.py", line 84, in auth_required
return wrapped(*args, **kwargs)
File "/trytond/protocols/wrappers.py", line 181, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 180, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond/model/modelview.py", line 380, in fields_view_get
result['arch'], result['fields'] = cls.parse_view(
File "/trytond/model/modelview.py", line 519, in parse_view
fields_def = cls.__parse_fields(
File "/trytond/model/modelview.py", line 721, in __parse_fields
fields_attrs = cls.__parse_fields(
File "/trytond/model/modelview.py", line 721, in __parse_fields
fields_attrs = cls.__parse_fields(
File "/trytond/model/modelview.py", line 721, in __parse_fields
fields_attrs = cls.__parse_fields(
[Previous line repeated 4 more times]
File "/trytond/model/modelview.py", line 625, in __parse_fields
field = cls._fields[fname]
KeyError: 'code'
Questions:
- Could there be access rights or domain constraints preventing
evaluations
from being displayed? - Are there any
ir.model.access
orir.ui.view
configurations that I might have missed? - How can I ensure the
evaluations
field is properly displayed in the patient form?
Any help would be greatly appreciated!