Dear all,
anyone knows how to print pdf report from python method? i have this wizard transient model, but when i call print_pdc nothing happens.
class WizardImprimirPDC(models.TransientModel):
_name = 'wizard.imprimir.pdc'
_description = 'Imprimir pla de control'
name = fields.Char(
string="Titulo"
)
desglose = fields.Selection(
string="Nivel de desglose:",
selection=[('1', 'Solo producto principal'),
('2', 'Producto y componentes'),
('3', 'producto, componentes y subcomponentes')])
producto_id = fields.Many2one(
comodel_name="product.product",
string="Producto",
required=True
)
fecha = fields.Date(
string="fecha del informe",
default=fields.Date.today()
)
@api.multi
def print_pdc(self, cr, context=None):
if context is None:
context = {}
data = self.read()[0]
datas = {
'ids': self.producto_id,
'model': 'wizard.imprimir.pdc',
'form': data
}
res = {
'type': 'ir.actions.report',
'report_name': 'reports/nd_calidad_pdc_es.odt',
'datas': datas
}
return res