(odoo10) 如何更改 pdf 发票中的行

(odoo10) how to change line in pdf invoice

我想更改 pdf 发票中的描述行 - 我想显示产品 SCU 而不是描述。

这是我在 report_invoice_document 中的内容:

<div class="row mt32 mb32"> <div class="col-xs-2" t-if="o.name"> <strong>Description:</strong> <p t-field=" <div class="row mt32 mb32"> <div class="col-xs-2" t-if="o.name"> <strong>Description:</strong> <p t-field="o.name"/> </div>"/> </div>

当我尝试将 o.name 更改为 o.product_id 时 - 我收到 503 服务器错误。

可能是我遗漏了什么,请教如何去做?

您正在尝试将引用发票记录名称的 o.name 更改为 o.product_id 它不是 account.invoice 模型的字段,它是 account.invoice.line 模型,它由 account.invoice 模型上的字段 invoice_line_ids 支持。

例如,您需要使用它来更改行:

<td><span t-field="l.name"/></td>

与:

<td><span t-field="l.product_id.name"/></td>