I have a list of vaccines e.g Covid, Cholera, etc, the patient's name, and the dose. A patient can have Cholera dose 1,2,3 now and in future dose 1,2.
Now, how can I show just the first name (John) of the patient in a given vaccine using python?
This is the data I have:
Vaccine patient_name dose Cholera John 1 John 2 John 3 John 1 John 2 Covid John 1 John 2 John 2
Here's my Code. Any assistance will be greatly appreciated.
@api.multi def print_report(self): data = { 'sizes': [], } p_list = self.env['med.vaccines'].search([]) patient_list = [] for i in p_list: if i.vaccine not in patient_list and i.patient not in patient_list: data['sizes'].append({ 'patient': i.patient, 'vaccine': i.vaccine, 'dose': i.dose }) patient_list.append(i.vaccine and i.patient) else: data['sizes'].append({ 'patient': '', 'vaccine': '', 'dose': '', }) return self.env.ref('med_vaccines.report_patient').report_action(self, data=data)