title: Create custom excel report from wizard in odoo 15
body: <p>I am trying to generate an excel report from wizard using <code>report_xlsx</code> module but i am getting below error.</p>
  <blockquote>
  <p>Traceback (most recent call last):
  File &quot;/home/kabeer/Projects/Odoo15ce/odoo/custom_addons/report_xlsx/controllers/main.py&quot;, line 76, in report_download
  response = self.report_routes(
  File &quot;/home/kabeer/Projects/Odoo15ce/odoo/http.py&quot;, line 535, in response_wrap
  response = f(*args, **kw)
  File &quot;/home/kabeer/Projects/Odoo15ce/odoo/custom_addons/report_xlsx/controllers/main.py&quot;, line 32, in report_routes
  data.update(json.loads(data.pop(&quot;options&quot;)))
  ValueError: dictionary update sequence element #0 has length 10; 2 is required</p>
  </blockquote>
  <p>Here is what i did.</p>
  <p>*<strong>.xml</strong></p>
  <pre><code>          &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
            &lt;odoo&gt;
              &lt;record id=&quot;open_purchase_order_print_menu&quot; model=&quot;ir.actions.report&quot;&gt;
                  &lt;field name=&quot;name&quot;&gt;Open PO&lt;/field&gt;
                  &lt;field name=&quot;model&quot;&gt;open.po&lt;/field&gt;
                  &lt;field name=&quot;report_type&quot;&gt;xlsx&lt;/field&gt;
                  &lt;field name=&quot;report_name&quot;&gt;transight.open_po&lt;/field&gt;
                  &lt;field name=&quot;report_file&quot;&gt;transight.open_po&lt;/field&gt;
                  &lt;field name=&quot;print_report_name&quot;&gt;'Purchase Order'&lt;/field&gt;
                  &lt;!-- &lt;field name=&quot;binding_model_id&quot; ref=&quot;purchase.model_purchase_order&quot;/&gt; --&gt;
                  &lt;field name=&quot;binding_type&quot;&gt;report&lt;/field&gt;
              &lt;/record&gt;
              &lt;record id=&quot;open_po_view_form&quot; model=&quot;ir.ui.view&quot;&gt;
                &lt;field name=&quot;name&quot;&gt;open.po.form&lt;/field&gt;
                &lt;field name=&quot;model&quot;&gt;open.po&lt;/field&gt;
                &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;
                  &lt;form string=&quot;Open PO&quot;&gt;
                      &lt;group&gt;
                        &lt;field name=&quot;mode&quot; required=&quot;1&quot;/&gt;
                      &lt;/group&gt;
                      &lt;group col=&quot;4&quot;&gt;
                        &lt;field name=&quot;purchase_order_id&quot;
                          widget=&quot;many2many_tags&quot;
                          attrs=&quot;{'invisible':[('mode','=','partnumber')]}&quot;/&gt;
                        &lt;field name=&quot;partnumber&quot; attrs=&quot;{'invisible':[('mode','=','po')]}&quot;/&gt;
                      &lt;/group&gt;
                      &lt;footer&gt;
                        &lt;button string=&quot;Print&quot; name=&quot;action_print&quot; type=&quot;object&quot; class=&quot;btn-primary&quot;/&gt;
                        &lt;button string=&quot;Cancel&quot; class=&quot;btn-secondary&quot; special=&quot;cancel&quot;/&gt;
                      &lt;/footer&gt;
                  &lt;/form&gt;
                &lt;/field&gt;
              &lt;/record&gt;
              &lt;record id=&quot;action_open_po&quot; model=&quot;ir.actions.act_window&quot;&gt;
                &lt;field name=&quot;name&quot;&gt;Open PO&lt;/field&gt;
                &lt;field name=&quot;res_model&quot;&gt;open.po&lt;/field&gt;
                &lt;field name=&quot;view_mode&quot;&gt;form&lt;/field&gt;
                &lt;field name=&quot;target&quot;&gt;new&lt;/field&gt;
              &lt;/record&gt;
              &lt;menuitem id=&quot;menu_open_po_action&quot; name=&quot;Open PO&quot; parent=&quot;mrp.menu_mrp_configuration&quot; action=&quot;action_open_po&quot; sequence=&quot;4&quot;/&gt;
            &lt;/odoo&gt;
  </code></pre>
  <p>*<strong>.py</strong></p>
  <pre><code>    from odoo import fields,models,api,_
  
  
      class OpenPOXlsx(models.AbstractModel):
          _name = 'report.transight.open_po'
          _inherit = 'report.report_xlsx.abstract'
          def generate_xlsx_report(self, workbook, data, partners):
              print('data',data)
              for obj in partners:
                  report_name = 'Excel Report test'
                  # One sheet by partner
                  sheet = workbook.add_worksheet(report_name[:31])
                  bold = workbook.add_format({'bold': True})
                  sheet.write(0, 0, 'Hi Am here', bold)
  
      class OpenPO(models.TransientModel):
          _name = 'open.po'
          _description = 'OpenPO'
  
          purchase_order_id = fields.Many2many('purchase.order',string='Purchase Order')
          partnumber = fields.Char(string=&quot;Partnumber&quot;)
          mode = fields.Selection([('partnumber','Part Number'),('po','Purchase Order')],string=&quot;Filter by&quot;)
  
          def action_print(self):
  
  
              if self.mode == 'po':
                  query = &quot;&quot;&quot;my query %s &quot;&quot;&quot;
  
                  self.env.cr.execute(query,(tuple(self.purchase_order_id.ids),))
                  datas = self.env.cr.dictfetchall()
                  print('data---------',datas)
              # return self.env.ref('account_batch_payment.action_print_batch_payment').report_action(self, config=False)
  
              return self.env.ref('transight.open_purchase_order_print_menu').report_action(self,data=datas)
  </code></pre>