Saludos comunitarios, necesito ayuda con un wizard y reporte StateReport, me sale el siguiente error en el cliente desktop, esta es la traza:
ERROR:gnuhealth.common.common: File "/home/nando/.virtualenvs/ts60/lib/python3.10/site-packages/gnuhealth/common/common.py", line 1164, in process
self.callback(return_)
File "/home/nando/.virtualenvs/ts60/lib/python3.10/site-packages/gnuhealth/action/main.py", line 56, in callback
type, data, print_p, name = result
TypeError: cannot unpack non-iterable NoneType object
Si alguien tuvo la experiencia y pudo resolverlo, me da una pista y estare agradecido.
Aqui el codigo:
class ImagingInformStart(ModelView):
'Vista reporte de imagenes por medico'
__name__ = 'gnuhealth.imaging_inform.start'
desde = fields.Date('Desde', required=True)
hasta = fields.Date('Hasta', required=True)
health_prof = fields.Many2One('gnuhealth.healthprofessional','Radiologo', required=True)
@staticmethod
def default_desde():
return date.today()
@staticmethod
def default_hasta():
return date.today()
class WizardImagingInformReport(Wizard):
'Wizard Reporte de imágenes informadas por medico'
__name__ = 'gnuhealth.wizard_imaging_inform_report'
start = StateView(
'gnuhealth.imaging_inform.start',
'health_int.imaging_inform_report_form', [
Button('Cancelar', 'end', 'tryton-cancel'),
Button('Imprimir', 'print_', 'tryton-ok', default=True),
])
print_ = StateReport('gnuhealth.imaging_inform.report')
def do_print_(self, action):
if self.start.desde <= self.start.hasta:
reporte_context = {
'desde': self.start.desde,
'hasta': self.start.hasta,
'health_prof': self.start.health_prof.id}
else:
raise UserError('Periodos errados, revise y corrija')
return action,reporte_context
def transition_print_(self):
return 'end'
class ImagingInformReport(Report):
'Reporte de imagenes informadas por medico'
__name__ = 'gnuhealth.imaging_inform.report'
@classmethod
def get_context(cls, records, header, data):
report_context = super().get_context(records, header, data)
print('getcontext'+str(report_context))
pool = Pool()
HealthProf = pool.get('gnuhealth.healthprofessional')
ImgResult = pool.get('gnuhealth.imaging.test.result')
User = pool.get('res.user')
dom = [
('date', '>=', data['desde']),
('date', '<=', data['hasta']),
('informed_by', '=', data['health_prof'])]
images = ImgResult.search(dom)
report_context['records'] = images
report_context['desde'] = data['desde']
report_context['hasta'] = data['hasta']
report_context['health_prof'] = HealthProf(data['health_prof']).rec_name
report_context['print_date'] = datetime.now()
return report_context
Aqui el xml
<!---reporte imagenes informadas por medico-->
<record model="ir.action.report" id="report_imaging_inform">
<field name="name">Reporte de Imagenes Informadas por Radiólogo</field>
<field name="model">gnuhealth.imaging.test.result</field>
<field name="report_name">gnuhealth.imaging_inform.report</field>
<field name="report">health_int/report/imaging_inform.fodt</field>
<field name="extension">pdf</field>
</record>
<record model="ir.ui.view" id="imaging_inform_report_form">
<field name="model">gnuhealth.imaging_inform.start</field>
<field name="type">form</field>
<field name="name">imaging_inform_start</field>
</record>
<record model="ir.action.wizard" id="wizard_imaging_inform_report">
<field name="name">Reporte de Estudios Informados por Médico</field>
<field name="wiz_name">gnuhealth.wizard_imaging_inform_report</field>
</record>