I'm using Odoo 8 and I've inherited account.invoice.line and added a new field:
class account_invoice_line(models.Model):
_inherit = "account.invoice.line"
price_unit_currency = fields.Float('Prix-Unitaire-Devise', store=False, readonly=True,
compute='_compute_pu_currency',
default=0.)
@api.one
def _compute_pu_currency(self):
self.price_unit_currency = line.price_unit * 1.28
In my report, I can print that field (first column) but doesn't show up in the second column:
<tr t-foreach="o.invoice_line" t-as="l">
<td>
<span t-esc="l.price_unit_currency"/>
</td>
<td>
<span t-field="l.price_unit_currency"/>
</td>
</tr>
When I generate my report, I get this error in the log:
2019-12-30 20:09:09,820 329299 WARNING My_Super_Module openerp.addons.base.ir.ir_qweb: Could not get field price_unit_currency for model account.invoice.line
I'd just like to understand why it works with t-esc, and not with t-field. https://www.odoo.com/documentation/8.0/reference/qweb.html didn't really helped me understand the mechanism but I suspect t-field to only work on stored fields, is that the case ? Where can I learn more about that ?
Thanks in advance to the community :)
Hope this will helps in future: http://learnopenerp.blogspot.com/search/label/Qweb