【问题标题】:add more id in a report from the same table在同一个表的报告中添加更多 id
【发布时间】:2020-03-25 07:44:52
【问题描述】:

我正在制作一份报告,可以将在一张表中创建的所有帐户合二为一。例如:我创建了“现金”、“银行”和“应付账款”的帐户,所以我选择了所有三个,它们出现在报告中。我目前正在这样做,但它仅在我选择 1 时出现,它不适用于多个。

制作此报告时显示的错误如下:

编译 AST 时出现错误 ValueError:预期的单例:proyecto_rc.account(3, 4) 模板:249 路径:/templates/t/t/t/t/div/div/thead/br/p/table/tbody/td[2]/span 节点:- - -

我在这里留下一张我想要的照片。:photo example

<report
    id="list_efectcredit"
    model="proyecto_rc.account"
    string="Lmayor"
    name="proyecto_rc.report_account_view"
    file="proyecto_rc.report_lmayorefectivo"
    report_type="qweb-html" />


<template id="report_account_view">
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="web.external_layout">
                <div class="page">
                    <div class="page">
                        <br></br>

                        <thead>
                            <center>
                                <h2>Ledger</h2>
                            </center>
                            <br>
                                <p>Detail:
                                    <table class="customTable">
                                        <thead>
                                            <tr>
                                                <th>Account</th>
                                                <th>Debit</th>
                                                <th>Credit</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <t t-set="i" t-value="1"/>

                                                <td>
                                                    <span t-field="o.title"/>
                                                </td>
                                                <td>
                                                    <span t-field="o.total_account_debit"/>
                                                </td>
                                                <td>
                                                    <span t-field="o.total_account_credit"/>
                                                </td>
                                            <t t-set="i" t-value="i+1"/>
                                        </tbody>
                                    </table>
                                </p>   
                            </br>

                        </thead>
                    </div>
                </div>
            </t>
        </t>
    </t>
</template>

【问题讨论】:

    标签: python html odoo


    【解决方案1】:

    试试这个例子

       <template id="report_account_view_detail">                 
        <table class="customTable">
            <thead>
                <tr>
                    <th>Account</th>
                    <th>Debit</th>
                    <th>Credit</th>
                </tr>
            </thead>
            <tbody>
                <t t-set="i" t-value="1"/>
    
                    <td>
                        <span t-field="account.title"/>
                    </td>
                    <td>
                        <span t-field="account.total_account_debit"/>
                    </td>
                    <td>
                        <span t-field="account.total_account_credit"/>
                    </td>
                <t t-set="i" t-value="i+1"/>
            </tbody>
        </table>
    </template>
    
     <template id="report_account_view">
        <t t-call="web.html_container">
            <t t-call="web.external_layout">
                <div class="page">
                    <t t-foreach="docs" t-as="account">
                        <t t-call="proyecto_rc.report_account_view_detail">
                            <t t-set="account" t-value="account"/>
                        </t>
                    </t>
                </div>
            </t>
        </t>
    </template>
    

    【讨论】:

      猜你喜欢
      • 2013-06-17
      • 2022-01-06
      • 1970-01-01
      • 2012-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多