in my module i want to use some relation between the models and my own model, so i do this:
class NurseCall(ModelSQL, ModelView):
"Nurse Call"
__name__ = "arnika.nurse.call"
name = fields.Many2One('gnuhealth.patient', 'Patient')
date = fields.DateTime('Date')
bed = fields.Many2One("gnuhealth.hospital.bed", 'nurse_call')
health_professional = fields.Many2One('gnuhealth.healthprofessional','Health Professional', readonly=True)
@classmethod
def __setup__(cls):
super().__setup__()
t = cls.__table__()
cls._sql_constraints = [
('name_uniq', Unique(t, t.name), 'The Name must be unique !'),]
and when i run trytond-admin -d test -u module its raise this error :
Traceback (most recent call last):
File "gnuhealth/tryton/server/trytond-6.0.27/bin/trytond-admin", line 23, in <module>
admin.run(options)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-6.0.27/trytond/admin.py", line 53, in run
pool.init(update=options.update, lang=list(lang),
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-6.0.27/trytond/pool.py", line 164, in init
restart = not load_modules(
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-6.0.27/trytond/modules/__init__.py", line 438, in load_modules
_load_modules(update)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-6.0.27/trytond/modules/__init__.py", line 406, in _load_modules
load_module_graph(graph, pool, update, lang)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-6.0.27/trytond/modules/__init__.py", line 238, in load_module_graph
cls.__register__(module)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-6.0.27/trytond/model/modelsql.py", line 264, in __register__
ref_model = pool.get(field.model_name)
File "/home/gnuhealth/gnuhealth/tryton/server/trytond-6.0.27/trytond/pool.py", line 187, in get
return self._pool[self.database_name][type][name]
KeyError: 'gnuhealth.hospital.bed'
and if I comment the #bed = fields.Many2One("gnuhealth.hospital.bed", 'nurse_call')
line, i still get this error but for one of other field and all of module are activated