1
votes

I have to add an item in print menu from purchase order tree view in odoo 8. i am unable to find where is current Purchase Order reports added in print menu. i researched and found there is a tag from below:

https://www.odoo.com/forum/help-1/question/how-to-add-an-item-to-the-more-drop-down-list-in-sales-module-61833

also tried below, but i am getting qweb error :

<act_window name="Print Receiving Wkst"
        res_model = "purchase.order"
        src_model = "purchase.order"
        key = "action"
        key2="client_print_multi"
        value="ir.actions.act_window,action_report_print_receivePO"
        id="act_print_recevg_wkst"
    />

my custom report is in "test" module with id "action_report_print_receivePO"

I am getting error for value tag i think.

Basically i have to add new entry in print menu from purchase order tree view. so that when ever it is clicked custom report is printed. moreover if more than one PO selected, it will create PDF of all the POs

Thanks,

2

2 Answers

2
votes

You don't need to go through the stress of creating an action and then adding a new item to the "More dropdown". Odoo already provides a way for you do this. just set menu = True when you're registering your report and a Print option would appear in the "More dropdown" that prints your report.

<report
    id="purchase_order_report"
    string="Purchase order"
    model="purchase.order"
    report_type="qweb-pdf"
    file="purchase.order.file"
    name="purchase.order.report"
    menu="True"
/>

For more information on what the other parameters mean please refer to the
docs

1
votes

just in case you might want to generate reports of a different types not fully supported by Odoo, such as py3o you'll definitely need to create a report action as defined in the official doc. For example:

<record id="account.account_invoices" model="ir.actions.report">
  <field name="report_type">py3o</field>
  <field name="py3o_filetype">odt</field>
  <field name="module">my_custom_module_base</field>
  <field name="py3o_template_fallback">report/account_invoice.odt</field>
</record>

However for your action to appear in the Print dropdown list, you must add two more fields to the record

<field name="binding_model_id" ref="model_my_custom_module_base"/>
<field name="binding_type">report</field>

Hope this helps anyone in the future!! NB: Here I'm using the py3o reporting engine. Check it out as an alternative to the native qweb engine.