Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
18555 Lượt xem

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.
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

<?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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 4 22
4799
0
thg 8 20
2041
7
thg 8 19
24407
2
thg 10 18
14541
0
thg 9 18
4180