Skip to Content
Menu
This question has been flagged
2 Replies
1885 Views

I am making a report which can print all the accounts created in a table in one. For example: I have the account created "Cash", "Bank" and "Payable" so I select all three and they appear in a report. I currently do it but it only appears when I select 1 it does not work with several.

The error shown when making this report is as follows:

Error to render compiling AST ValueError: Expected singleton: proyecto_rc.account(3, 4) Template: 249 Path: /templates/t/t/t/t/div/div/thead/br/p/table/tbody/td[2]/span Node: <span t-esc="o.total_account_debit"/>-

Here I leave a picture of how I want it to be.: \photoexamplereport

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

Avatar
Discard
Best Answer

Hello

It look like your total_account_debit is actually a one2many or many2many to the accountproyecto_rc.account model. If you're trying to print the value of total debits, you should move the o2m/m2m to a field named account_debit_ids and then make total_account_debit a computed field that sums the linked accounts.

Cheers
Jake Robinson


Avatar
Discard
Best Answer

Hi,

You can iterate the o over a for loop to fix the singleton issue.

See a sample:

<t t-foreach="o" t-as="doc">
<t t-esc="doc.field"/>
</>


Thanks

Avatar
Discard
Related Posts Replies Views Activity
2
Dec 19
5791
3
Apr 24
1002
0
May 24
46
1
Apr 24
1822
4
Sep 23
3075