Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Appointment(ModelSQL, ModelView):
- 'Patient Appointments'
- __name__ = 'gnuhealth.appointment'
- insurance = fields.Function(fields.Char('Insurance'), 'get_insurance')
- insurancecode = fields.Function(fields.Char('Insurance'), 'get_insurancecode')
- insurancenumber = fields.Function(fields.Char('Insurance'), 'get_insurancenumber')
- codenomenclador = fields.Function(fields.Char('Nomenclador'), 'get_nomenclador')
- tipo = fields.Function(fields.Char('Nomenclador'), 'get_tipo')
- def get_insurance(self, name):
- res = ''
- if self.patient.current_insurance:
- res = self.patient.current_insurance.company.name
- return res
- def get_insurancenumber(self, name):
- res = ''
- if self.patient.current_insurance:
- res = self.patient.current_insurance.number
- return res
- def get_insurancecode(self, name):
- res = ''
- if self.patient.current_insurance:
- res = self.patient.current_insurance.company.ref
- return res
- def get_nomenclador(self, name):
- res = ''
- pool = Pool()
- if (self.healthprof and self.healthprof.main_specialty):
- hp_main_specialty = self.healthprof.main_specialty.specialty.id
- hprof_id = self.healthprof.id
- hp_specialty_obj = Pool().get('gnuhealth.hp_specialty')
- hp_spec = hp_specialty_obj.search(
- [('name', '=', hprof_id)], limit=1)[0]
- if hp_spec.nomenclador:
- hp_nomenclador = hp_spec.nomenclador.codigo
- res = hp_nomenclador
- return res
- def get_tipo(self, name):
- res = ''
- pool = Pool()
- if (self.healthprof and self.healthprof.main_specialty):
- hp_main_specialty = self.healthprof.main_specialty.specialty.id
- hprof_id = self.healthprof.id
- hp_specialty_obj = Pool().get('gnuhealth.hp_specialty')
- hp_spec = hp_specialty_obj.search(
- [('name', '=', hprof_id)], limit=1)[0]
- if hp_spec.nomenclador:
- tipo_nomenclador = hp_spec.nomenclador.tipo
- res = tipo_nomenclador
- return res
Advertisement
Add Comment
Please, Sign In to add comment