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
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
ced
(CĆ©dric Krier)
May 15, 2021, 7:26pm
2
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.
ced
(CĆ©dric Krier)
May 16, 2021, 4:26pm
4
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?
pokoli
(Sergi Almacellas Abellana)
May 17, 2021, 6:53am
6
Both options are equivalent. For clarify I prefer to use new()