Dear all,
I am using Odoo 12 and need to print (on the sales order report) a resume of all taxes included on the sales order.
For this, I have tried to create a binary field and pass a dictionary to this field on a computed field.
What I have tried:
1. On the model:
tax_on_lines = fields.Binary(string="Taxes Lines", compute='_check_taxes')
def _check_taxes(self):
for document in self:
res = {}
for line in document.order_line:
tax = line.tax_id
res.update({tax.name: tax.description})
document.tax_on_lines = res
print(document.tax_on_lines)
On the sales order report xml:
<t t-foreach="doc.tax_on_lines" t-as="tax_on_lines">
<span t-esc="tax_on_lines"/>
</t>
This is not working (at least for the xml - nothing is printed on the report) and I am sure the problem is on the "_check_taxes" method.
When I look to the print() method on the model, I get the following result:
{'V01': 'Tax description 1', 'V02': 'Tax description 2', 'V05': 'Tax description 5', 'V03': 'Tax description 3'}
So, this ensures that the values are being passed to the "res" dictionary, but in some point the values are not passed to the xml.
Can anyone help me?
Basically I need to print on the sales order report, all taxes included on the sales order. Something like:
VAT1 - VAT 10%
VAT2 - VAT 13%
VAT5 - VAT 23%
VAT3 - VAT 15%
Thank you all in advance
Best regards
Paulo