I add internal reference of product to the sale form and I want it in the invoice report also
the sale code is :
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')
this is my code but did not work
the python code:
class invoiceLineField(models.Model):
_inherit='account.invoice.line'
internal_ref=fields.Char(related='product_id.default_code',string='Internal
reference product',store=True)
and this is xml report:
<?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>
no error but the internal reference of product did not appear in the result
<span t-field="l.product_id.default_code"/>