Proteus, hot to get required fields

Hello,

I am working with gnuhealth and trying to use the proteus package to insert demo data into my system.

Unfortunately the docu for proteus is really short and I struggle to figure some things out :frowning:

I know how to get the name of the models from ā€œAdministration>Models>Modelsā€.

But how do I get the values which need to be assigned to create a new patient in my case?

from proteus import config, Model, Wizard, Report

config.set_trytond('postgres:///health')

Patient = Model.get('gnuhealth.patient')
pat = Patient()

# which fields are required?
pat.name = "Max"
# ...
pat.save()

This gives me an Assertion Error, without any further information.
My guess is, that the model Patient needs more fields assigned.

Is there a place or page in the gui where I might have a look at the required fields?

Thanks and kind regards
Andreas

Which assertion? Could you provide the error message?

Thanks for the answer.
I figured out that the Patient model does not have a ā€œnameā€ field but the party model has one.
My Assertion Error is gone after removing this specific line.

May I ask you something about the creation of parties?
I do not understand how the one2many realtion is supposed to be used with proteus.

Currently I create an address like follows:

Address = Model.get('party.address')
address = Address()
address.active = True
address.city = row[17]
address.full_address = f'{row[16]} {row[20]} {row[17]}'
address.street = row[16]
address.zip = row[20]

Do I have to call the save() method on the address object?
Or do I simply assign this address to a party? If yes, how?

I would really appreciate a small example or a link to the documentation where this topic is dealt with.

This is shown in the documentation: Tryton Scripting Client ā€” tryton-proteus latest documentation

Okay, so addresses is a list and my address object can be simply appended to it, right?
Or is the new() method the only/preferred way to assign an address?

Both options are equivalent. For clarify I prefer to use new()