Unable to Display "Evaluations" Tab in a Form

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:

  1. xxx.patient.evaluation
  • Fields: code, evaluation_start, evaluation_endtime, state
  • Many2One relationship to xxx.patient
  1. xxx.patient
  • Field evaluations as One2Many to xxx.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:

  1. 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
  1. 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 in xxx.patient is a Many2One to party.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.
  1. 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:

  1. Could there be access rights or domain constraints preventing evaluations from being displayed?
  2. Are there any ir.model.access or ir.ui.view configurations that I might have missed?
  3. How can I ensure the evaluations field is properly displayed in the patient form?

Any help would be greatly appreciated! :pray:

I think that the problem is the view definition. Have you tried simplifying your XML code to just this and try if it works?

If you want to display a specific view of the evaluation model, you should use view_ids attribute. There are a lot of examples in the code you can check.