Guest User

Untitled

a guest
Sep 28th, 2016
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class reg(object):
  2. def __init__(self, cursor, row):
  3. for (attr, val) in zip((d[0] for d in cursor.description), row) :
  4. setattr(self, attr, val)
  5.  
  6.  
  7. class Appointment(ModelSQL, ModelView):
  8. 'Patient Appointments'
  9. __name__ = 'gnuhealth.appointment'
  10.  
  11.  
  12. padron = fields.Function(fields.Char('Padronnac'), 'get_padronnac')
  13.  
  14.  
  15. def get_padronnac(self, name):
  16. res = ''
  17. cursor = Transaction().cursor
  18. ndni=self.patient.name.ref
  19. cursor.execute("""SELECT gnuhealth_padronnac.id,
  20. gnuhealth_padronnac.tipodocumento,
  21. gnuhealth_padronnac.nrodocumento,
  22. gnuhealth_padronnac.apellidoynombre,
  23. gnuhealth_padronnac.cuilbeneficiario,
  24. gnuhealth_padronnac.cuiltitular,
  25. gnuhealth_padronnac.sexo,
  26. gnuhealth_padronnac.tipobeneficiario,
  27. gnuhealth_padronnac.cuitemlpleador,
  28. gnuhealth_padronnac.codigopostal,
  29. gnuhealth_padronnac.provincia,
  30. gnuhealth_padronnac.codigoparentesco,
  31. gnuhealth_padronnac.ultperiodoaporte,
  32. gnuhealth_padronnac.codobrasoc,
  33. gnuhealth_padronnac.fechanacimiento,
  34. party_party.name,
  35. party_party.ref FROM public.gnuhealth_padronnac, public.party_party
  36. WHERE gnuhealth_padronnac.codobrasoc = party_party.ref AND nrodocumento = %s """, (ndni,))
  37. for row in cursor.fetchall():
  38. res = reg(cursor, row)
  39. return res
RAW Paste Data