我想打印一个表的多个ID,但是出现错误,我认为这是因为我尝试显示一个计算字段。我一次只能打印一个ID,而不能全部打印。 出现的错误如下:
渲染AST时出错 ValueError:预期的单例:project_rc.account(3,4) 模板:252 路径:/模板/ t / t / t / t / div /表/ tfoot / tr [1] / th [2] /跨度 节点:t-esc =“ i.total_account_debit” />
代码如下:
<t t-call = "web.html_container">
<t t-foreach = "docs" t-as = "i">
<t t-call = "web.external_layout">
<div class = "page">
<t t-foreach = "i.detail_document_ids" t-as = "o">
<tr>
<td>
<span t-esc = "o.date" />
</td>
<td>
<span t-esc = "o.razon_social_id.name" />
</td>
<td>
<span t-esc = "o.total_debit" />
</td>
<td>
<span t-esc = "o.total_credit" />
</td>
</tr>
</t>
<tfoot>
<tr> <th colspan = "2" style = "text-align: center"> Total </th>
<th style = "text-align: center"> <span t-esc = "i.total_account_debit" /> </th>
<th style = "text-align: center"> <span t-esc = "i.total_account_credit" /> </th> </tr>
<tr> <th colspan = "2" style = "text-align: center"> Balance </th>
<th colspan = "2" style = "text-align: center"> <span t-esc = "i.balance" /> </th> </tr>
</tfoot>
表格“帐户” py
title = fields.Char (string = "Name")
total_account_debit = fields.Float (string = "Total account must", compute = "_ total_account_debit")
total_account_credit = fields.Float (string = "Total account have", compute = "_ total_account_credit")
balance = fields.Float (string = "Balance", compute = "_ balance")