Report 从odoo 9中的向导生成报告

Report 从odoo 9中的向导生成报告,report,openerp,odoo-9,qweb,Report,Openerp,Odoo 9,Qweb,我需要有关在ODOO9中从向导生成报告的帮助。在互联网上我发现了一个未完成的例子。我想让所有用户都是res.user,其中create_date(res.users中的字段)>=date_from,并从我的wizzard获取报告中的报告,检查使用附件变量是否设置为true。这会导致从数据库重新加载报表,而不是从重新呈现的数据库重新加载报表。默认情况下未选中!我尝试两种变体再次报告在2 pdf页面! <?xml version="1.0" encoding="utf-8"?> <

我需要有关在ODOO9中从向导生成报告的帮助。在互联网上我发现了一个未完成的例子。我想让所有用户都是res.user,其中create_date(res.users中的字段)>=date_from,并从我的wizzard获取 我的消息来源:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="view_my_wiz_form" model="ir.ui.view">
            <field name="name">print.report.form</field>
            <field name="model">my.test.report</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Print Report">
                    <group colspan="4" >
                        <field name="date_from"/>
                        <field name="date_to" />
                    </group>                            
                    <group colspan="4" col="6">                     
                        <button  name="print_report" string="Print Users" type="object"/>
                   </group>
               </form>
            </field>
        </record>

        <record id="action_my_wiz_form" model="ir.actions.act_window">
            <field name="name">Print Report</field>
            <field name="res_model">my.test.report</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
           <field name="view_id" ref="view_my_wiz_form"/>
           <field name="target">new</field>        
        </record>

        <menuitem name="REPORT" id="menu_my_test_report" action="action_my_wiz_form" sequence="19"/>    
    </data>
</openerp>
在控制台中获取[3,4]

我正在尝试使用这个xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_sasa_test">
    <t t-call="report.html_container">
        <t t-set="data_report_margin_top" t-value="12"/>
        <t t-set="data_report_header_spacing" t-value="9"/>
        <t t-set="data_report_dpi" t-value="110"/>
        <t t-foreach="docs" t-as="o">
                <div class="page">

                    <table class="table table-condensed">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Test</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><t t-esc="o.name"/></td>
                                <td><t t-esc="o.name"/></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
        </t>
    </t>
</template>
</odoo>

docs
变量默认表示模型上的记录,除非您另行定义。我看不到您在这里的其他地方定义它,所以您的问题是您有
t-foreach=“docs”
,然后您创建了一个页面。
t-foreach=“docs”
应该包含整个报告视图,而不是页面。看看
addons/account/views/report\u invoince.xml
这个循环是如何工作的

<template id="report_report_sasa_test">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="your_module.report_sasa_test" t-lang="o.partner_id.lang"/>
        </t>
    </t>
</template>


我尝试使用此示例,但在两个pdf页面上再次显示一个数据,而不是一个数据。检查设置->报告中的报告,检查使用附件变量是否设置为true。这会导致从数据库重新加载报表,而不是从重新呈现的数据库重新加载报表。默认情况下未选中!我尝试两种变体再次报告在2 pdf页面!
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_sasa_test">
    <t t-call="report.html_container">
        <t t-set="data_report_margin_top" t-value="12"/>
        <t t-set="data_report_header_spacing" t-value="9"/>
        <t t-set="data_report_dpi" t-value="110"/>
        <t t-foreach="docs" t-as="o">
                <div class="page">

                    <table class="table table-condensed">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Test</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><t t-esc="o.name"/></td>
                                <td><t t-esc="o.name"/></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
        </t>
    </t>
</template>
</odoo>
id |  login    | signature
3  |  25.01.17 | ---
4  |  25.01.17 | ---
<template id="report_report_sasa_test">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="your_module.report_sasa_test" t-lang="o.partner_id.lang"/>
        </t>
    </t>
</template>