This question has been flagged
3 Replies
17453 Views

I created my own menu and submenus, and form. And i created button in form for print custom qweb report. But i could not make button function. I have already created report template, how can i make button function to print report? Once i have done print custom report like this;

<openerp>
    <data>
        <report
            id="payment_report_custom"
            string="Payment Report"
            model="account.payment"
            report_type="qweb-pdf"
            file="custom_reports.payment_rpt"
            name="custom_reports.payment_rpt"
            paperformat="custom_reports.izmer_paperformat"
        />
    </data>
</openerp>
but this creates odoos print button, i did'not create any custom button. Now, this time i want my own print button.
Thank you.
Avatar
Discard
Best Answer

You don't need a function you just need the action id for the template and add it  to the button in your view.

<button name="%(action_report_my_report)d" string="Get report" type="action"/>

Hope this will help you

Avatar
Discard
Best Answer

Hi Serdar Eren,

In Odoo 10, you can add your custom qweb report print button by using menu=”True” attribute  in report tag.

<odoo>
    <data>
        <report
            id="payment_report_custom"
            string="Payment Report"
            model="account.payment"
            report_type="qweb-pdf"
            file="custom_reports.payment_rpt"
            name="custom_reports.payment_rpt"
            paperformat="custom_reports.izmer_paperformat"
            menu=”True”
        />
    </data>
</odoo>

I hope this will help you.

Thanks!

Avatar
Discard
Best Answer

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

<odoo>

<data>

<report

id="report_account_payment"

string="Print Payment Supplier"

model="account.payment"

report_type="qweb-pdf"

file="odoo-juvisk/report/report_account_payment"

name="odoo-juvisk.report_account_payment_view" />

<template id="report_account_payment_view">

<t t-call="report.html_container">

<t t-foreach="docs" t-as="doc">

<t t-call="report.external_layout">

<div class="page">

<div class="oe_structure"/>

<h2>Payment Supplier # <span t-field="doc.name"/></h2>

<div class="row">

<div class="col-xs-6">

<strong>Date:</strong>

<p t-field="doc.payment_date"/>

<strong>Partner:</strong>

<p t-field="doc.partner_id.name"/>

<strong>Amount:</strong>

<p t-field="doc.amount"/>

</div>

<div class="col-xs-6">

<strong>Journal:</strong>

<p t-field="doc.journal_id.name"/>

</div>

</div>

</div>

</t>

</t>

</t>

</template>

</data>

</odoo>


I hope can help you

Avatar
Discard