我将产品的内部参考添加到销售表单中,我也希望在发票报告中
销售代码是:
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
_name = 'sale.order.line'
x_field = fields.Float('Unit cost')
internal_ref=fields.Char(related='product_id.default_code',string='Internal
reference product',store=True,default=100)
partner_name=fields.Many2one('res.partner','partner_id.name')
这是我的代码,但没有用
python代码:
class invoiceLineField(models.Model):
_inherit='account.invoice.line'
internal_ref=fields.Char(related='product_id.default_code',string='Internal
reference product',store=True)
这是xml报告:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="report_invoice_document_itemnumber"
inherit_id="account.report_invoice_document">
<xpath expr="//div[contains(@class, 'page')]/table[1]/thead/tr/th[1]"
position="before">
<th>Internal reference</th>
</xpath>
<xpath expr="//div[contains(@class, 'page')]/table[1]/tbody/tr/td[1]"
position="before">
<td>
<span t-field="l.internal_ref"/>
</td>
</xpath>
</template>
</data>
</odoo>
没有错误,但产品的内部参考没有出现在结果
中答案 0 :(得分:0)
<span t-field="l.product_id.default_code"/>