I'm having trouble append extra information to the information_block of the DIN5008 template.
I inherited the sale.order module like suggested here.
I tried override both _compute_l10n_de_template_data
functions in the sale.order and the account.move but nothing changes. I can't append nor leave everything empty.
If I look for models in the odoo inteface I can see, that my module inherits the sale.order and account.move model. So I don't think I have an error in my __init__.py
files. I can also create new fields, but trying to overwrite those functions won't change the output in the report.
Here is my code for the sale.order model:
from odoo import models, fields, _
from odoo.tools import format_date
class SaleOrder(models.Model):
_inherit = 'sale.order'
l10n_de_template_data = fields.Binary(compute='_compute_l10n_de_template_data')
def _compute_l10n_de_template_data(self):
for record in self:
record.l10n_de_template_data = data = []
if record.state in ('draft', 'sent'):
if record.name:
data.append((_("Quotation No."), record.name))
if record.date_order:
data.append((_("Quotation Date"), format_date(self.env, record.date_order)))
if record.validity_date:
data.append((_("Expiration"), format_date(self.env, record.validity_date)))
else:
if record.name:
data.append((_("Order No."), record.name))
if record.date_order:
data.append((_("Order Date"), format_date(self.env, record.date_order)))
if record.client_order_ref:
data.append((_('Customer Reference'), record.client_order_ref))
if record.user_id:
data.append((_("Salesperson"), record.user_id.name))
if record.partner_id:
data.append((_("Customer"), record.partner_id))
It doesn't matter what I do to _compute_l10n_de_template_data
I can't see my changes in an offer or invoice (if I change the function in account.move)
Seems like I'm doing something fundamentally wrong.