Hello ,
i just implemented a one2many relationship
class HealthInstitutionHealthProf(ModelSQL, ModelView):
'Health Institution Health Prof'
__name__ = 'gnuhealth.institution.healthprof'
name = fields.Many2One('gnuhealth.institution', 'Institution',
required=True)
healthprof = fields.Many2One('gnuhealth.healthprofessional', 'Health Professional',
required=True)
def get_rec_name(self, name):
if self.healthprof :
return self.healthprof .name
class HealthInstitutionO2M(ModelSQL, ModelView):
'Health Institution'
__name__ = 'gnuhealth.institution'
healthprof = fields.One2Many('gnuhealth.institution.healthprof',
'name','Health Prof',
help="Operational Sectors covered by this institution")
but i am getting the following error
Traceback (most recent call last):
File "/home/gnuhealth/.local/lib/python3.8/site-packages/werkzeug/serving.py", line 306, in run_wsgi
execute(self.server.app)
File "/home/gnuhealth/.local/lib/python3.8/site-packages/werkzeug/serving.py", line 294, in execute
application_iter = app(environ, start_response)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.28/trytond/wsgi.py", line 121, in __call__
return self.wsgi_app(environ, start_response)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.28/trytond/wsgi.py", line 127, in __call__
return self.app(environ, start_response)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.28/trytond/wsgi.py", line 108, in wsgi_app
response = cls.response(data, request)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.28/trytond/protocols/jsonrpc.py", line 159, in response
return Response(json.dumps(
File "/usr/lib/python3.8/json/__init__.py", line 234, in dumps
return cls(
File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-5.0.28/trytond/protocols/jsonrpc.py", line 61, in default
return marshaller(obj)
File "/usr/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type party.party is not JSON serializable
any idea where it did go wrong ?