# HG changeset patch # User Luis Falcon # Date 1508866461 -3600 # Node ID bd8fd02e9a6ec5737efa09eca412595d10407bf1 # Parent e0da7fde59f73838538878a6f3fece081e8523e1 Fix bug #52275: Traceback when creating a free slot in appointments or work schedule diff --git a/tryton/health_calendar/health_calendar.py b/tryton/health_calendar/health_calendar.py --- a/tryton/health_calendar/health_calendar.py +++ b/tryton/health_calendar/health_calendar.py @@ -113,6 +113,9 @@ if appointment.healthprof: if appointment.healthprof.name.internal_user.calendar: patient = Patient(values['patient']) + comments = '' + if 'comments' in values: + comments = values['comments'] events = Event.create([{ 'dtstart': appointment.appointment_date, 'dtend': appointment.appointment_date_end, @@ -120,7 +123,7 @@ appointment.healthprof.name.internal_user.calendar.id, 'summary': patient.name.rec_name, - 'description': values['comments'], + 'description': comments, }]) values['event'] = events[0].id return super(Appointment, cls).write(appointments, values) diff --git a/tryton/health_qrcodes/health_qrcodes.py b/tryton/health_qrcodes/health_qrcodes.py --- a/tryton/health_qrcodes/health_qrcodes.py +++ b/tryton/health_qrcodes/health_qrcodes.py @@ -92,26 +92,32 @@ # Create the QR code appointment_healthprof = '' - appointment_speciality = '' + appointment_patient = '' + patient_puid = '' + appointment_specialty = '' appointment_date = '' + appointment = '' - appointment = self.name or '' + if (self.name): + appointment = self.name if (self.healthprof): appointment_healthprof = str(self.healthprof.rec_name) or '' - appointment_patient = self.patient.rec_name or '' - + if (self.patient): + appointment_patient = self.patient.rec_name or '' + patient_puid = self.patient.puid + if (self.appointment_date): appointment_date = str(self.appointment_date) if (self.speciality): - appointment_speciality = str(self.speciality.rec_name) or '' + appointment_specialty = str(self.speciality.rec_name) or '' - qr_string = 'ID: ' + self.name or '' \ + qr_string = 'ID: ' + appointment \ + '\nName: ' + appointment_patient \ - + '\nPUID: ' + self.patient.puid or ''\ - + '\nSpecialty: ' + appointment.speciality or ''\ + + '\nPUID: ' + patient_puid \ + + '\nSpecialty: ' + appointment_specialty \ + '\nhealth Prof: ' + appointment_healthprof or ''\ + '\nDate: ' + appointment_date or ''