Search code examples
pythonreportodoo-11

ValueError: not enough values to unpack (expected 2, got 1) Odoo 11 Costum Report


Im facing this Probleme After Using my Costum report here is the code

lass carnetcheque(models.Model): _name = 'carnet.c'

cheque_id = fields.One2many(comodel_name='cheq.c', string='Carnet cheq', inverse_name='carnetcheque_id')
code_cheq = fields.Char(string='Code Chèque',default="")
nbr_feuill = fields.Char(string='Nombre feuille')
date_debut_carnet = fields.Date(string='Date début Carnet')
status = fields.Selection(selection=[('en cours', 'En Cours'),
                                     ('terminé', 'Terminé')])
@api.multi
def imprimer_report(self):

    return self.env.ref('car_report_id').report_action(self, data=data, config=False)

About the XML files

<?xml version="1.0" encoding="utf-8"?>

    <report
            id="car_report_id"
            string="Report of adham"
            model="carnet.c"
            report_type="qweb-pdf"
            file="carnet.c.carnet_report_id"
            name="carnet.c.carnet_report_id"
            menu="False"
    />



</data>

The Action Id

<template id="car_report_id">

Would you please help


Solution

  • You have to put your module_name before "car_report_id" in self.env.ref() like that:

    self.env.ref('module_name.car_report_id').report_action(self, data=data, config=False)
    

    Good luck.