Skip to Content
Menu
This question has been flagged
3 Replies
7106 Views

hello,

i have a static xml report (no dependent of class) like this:
 <report

id="report_fiche_id"
model=""
string="Imprimer fiche"
report_type="qweb-pdf"
name="mon_gestionnaire.report_fiche"
file="mon_gestionnaire.report_fiche"
/>

and i'ld like to print it directly from menu item like :

<menuitem id="gest_fiche" name="Fiche journalière" parent="gest_imp" sequence="2" action="report_fiche_id"/>​

but on click on this menu a got this erreu:

{

Traceback (most recent call last):
  File "C:\Program Files\Odoo 11.0e\server\odoo\addons\web\controllers\main.py", line 1666, in report_download
    data = url_decode(url.split('?')[1]).items()  # decoding the args represented in JSON
IndexError: list index out of range

}

i want help to be able to print.

Avatar
Discard

and ... what do you expect ... ???

Best Answer

Hello @jonathan,

To print a static report from menu odoo11

Please, use this below code to print sale order report from menu

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

<odoo>

<!--print_report method is called from server action-->

<record id="action_sale_report" model="ir.actions.server">

<field name="name">Sale Report</field>

<field name="type">ir.actions.server</field>

<field name="model_id" ref="model_sale_order"/>

<field name="state">code</field>

<field name="code">

action = model.print_report()

</field>

</record>

<!--Menu to Print Sale Report-->

<menuitem id="menu_sale_report" name="Print Sale Report"

parent="sale.menu_sale_report" sequence="110" action="action_sale_report"/>

</odoo>

class SaleOrder(models.Model):

_inherit = 'sale.order'

@api.multi

def print_report(self):

# Method to print sale order report

sale_ids = self.search([], limit=1).ids

return self.env.ref(

'sale.action_report_saleorder').report_action(sale_ids)

print_report() is called from server action which prints the report.

Server action is called from the menu.


Regards,




Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Avatar
Discard

I just created the report from wizard. but it shows blank report. How can I solve it.