# -*- coding: utf-8 -*- from openerp import models, fields, api class ClinicMedicvisit(models.Model): _inherit = 'clinic.history' @api.model def getClinicMedicvisit(self,domain): ClinicMedicvisit = self.env['clinic.history'].search(domain) values = [] for clinichistory in ClinicMedicvisit: try: street = clinichistory.partner_id.street except Exception as e: street = '' values.append({ # ID 'id': clinichistory.id, # WORKORDER INFO 'name': clinichistory.name or "", 'user_name': clinichistory.user_id.name or "", 'paramedico_name': clinichistory.paramedico_id.name or "", 'order_date': clinichistory.order_date or "", 'name_movil': clinichistory.name_movil or "", 'at_base': clinichistory.at_base or "", 'nro_salida': clinichistory.nro_salida or "", 'planned_start_date': clinichistory.planned_start_date or "", 'programado': clinichistory.programado or "", 'edad_paciente': clinichistory.edad_paciente or "", 'antig_trabajo': clinichistory.antig_trabajo or "", 'planned_end_date': clinichistory.planned_end_date or "", 'lugar_visita': clinichistory.lugar_visita or "", 'tipo_paciente': clinichistory.tipo_paciente or "", 'uso_gel': clinichistory.uso_gel or "", 'seguro': clinichistory.seguro or "", 'nro_socio': clinichistory.nro_socio or "", 'nro_socio1': clinichistory.nro_socio1 or "", 'alergico': clinichistory.alergico or "", 'tipo_alergico': clinichistory.tipo_alergico or "", 'embarazada': clinichistory.embarazada or "", 'respuesta_tratamiento': clinichistory.respuesta_tratamiento or "", 'pa': clinichistory.pa or "", 'fc': clinichistory.fc or "", 'fr': clinichistory.fr or "", 'temp': clinichistory.temp or "", 'so': clinichistory.so or "", 'hgt': clinichistory.hgt or "", 'ost': clinichistory.ost or "", 'asm': clinichistory.asm or "", 'card': clinichistory.card or "", 'acv': clinichistory.acv or "", 'conv': clinichistory.conv or "", 'hta': clinichistory.hta or "", 'epoc': clinichistory.epoc or "", 'otro': clinichistory.otro or "", 'motivo': clinichistory.motivo or "", 'diagnostic': clinichistory.diagnostic or "", 'indicacion': clinichistory.indicacion or "", 'recommendations': clinichistory.recommendations or "", 'epicrisis': clinichistory.epicrisis or "", 'presuntivo': clinichistory.presuntivo or "", 'clasificacion': clinichistory.clasificacion or "", 'informado': clinichistory.informado or "", 'entregado': clinichistory.entregado or "", 'signature_image_paramedico': clinichistory.signature_image_paramedico or "", 'signature_image_medico': clinichistory.signature_image_medico or "", 'signature_image_paciente': clinichistory.signature_image_paciente or "", # PARTNER INFO 'partner_id': clinichistory.partner_id.id or "", 'partner_name': clinichistory.partner_id.name or "", 'paciente_id': clinichistory.paciente_id.id or "", 'paciente_name': clinichistory.paciente_id.name or "", 'partner_ruc': clinichistory.partner_id.ruc or "", 'partner_address': street or "", 'partner_phone': clinichistory.partner_id.phone or "", 'partner_mobile': clinichistory.partner_id.mobile or "", 'partner_fecha_nac ': clinichistory.partner_id.fecha_nac or "", 'partner_sexo': clinichistory.paciente_id.sexo or "", # COMPANY INFO 'company_id': clinichistory.user_id.company_id.id or "", 'company_name': clinichistory.user_id.company_id.name or "", 'company_logo': clinichistory.user_id.company_id.logo or "", 'company_address': clinichistory.user_id.company_id.street2 or "", 'company_phone': clinichistory.user_id.company_id.phone or "", 'vat': clinichistory.user_id.company_id.vat or "", # USER INFO 'user_id': clinichistory.user_id.id or "", 'user_image': clinichistory.user_id.image or "", # PARAMEDICO INFO 'paramedico_id': clinichistory.paramedico_id.id or "", 'paramedico_image': clinichistory.paramedico_id.image or "", }) return values class ClinicMedicvisitLine(models.Model): _inherit = 'clinic.history.line' @api.model def getClinicMedicvisitLine(self,domain): ClinicMedicvisitLine = self.env['clinic.history.line'].search(domain) values = [] for line in ClinicMedicvisitLine: values.append({ # ID 'id': line.id, # LINE INFO 'clinichistory_id': line.clinichistory_id.id, 'product_id':[ line.product_id.id, line.product_id.name, ], 'quantity': line.quantity or "", 'brand': line.brand or "", 'number': line.number or "", }) return values class ClinicInsumosvisitLine(models.Model): _inherit = 'clinic.insumos.line' @api.model def getClinicInsumosvisitLine(self,domain): ClinicInsumosvisitLine = self.env['clinic.insumos.line'].search(domain) values = [] for line in ClinicInsumosvisitLine: values.append({ # ID 'id': line.id, # LINE INFO 'clinicinsumos_id': line.clinichistory_id.id, 'product_id':[ line.product_id.id, line.product_id.name, ], 'quantity': line.quantity or "", 'brand': line.brand or "", 'number': line.number or "", }) return values