How to display tax for each line in Report?

Hi community,

I have a question about sales and invoices. If I do the follow sale with two sale lines with tax defined (13%):

Line 1
Price 100
Tax 13
Total amount 113

Line 2
Price 200
Tax 26
Total amount 226

How do I show in the sales or invoice report only the tax each line ?

The invoice report will show you grouped tax amounts for all lines with taxes.

If you want to show each tax line separately you should modify the invoice report.

Hi josesalvador what field i need to add to show tax line separately on reports?

I guess you are looking for this one.

thanks for advice @josesalvador, i used this field:

<format_currency(line.invoice_taxes, invoice.party.lang, currency=invoice.currency)>

but received this error:

return eval(self.code, _globals, {'__data__': data})
  File "<string>", line 1182, in <Expression '__relatorio_escape_invalid_chars(format_currency(line.invoice_taxes, invoice.party.lang, currency=invoice.currency))'>
  File "/trytond/report/report.py", line 405, in format_currency
return lang.currency(value, currency, symbol, grouping)
  File "/trytond/ir/lang.py", line 441, in currency
'%%.%if' % digits, abs(val), grouping, monetary=True)
TypeError: bad operand type for abs(): 'tuple'

Fault: bad operand type for abs(): 'tuple'

later i used this field with abs

<format_currency(abs(line.invoice_taxes), invoice.party.lang, currency=invoice.currency)>

but i received this error:

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 108, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 48, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 76, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 186, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/modules/account_invoice/invoice.py", line 2512, in execute
    result = super(InvoiceReport, cls).execute(ids, data)
  File "/trytond/report/report.py", line 195, in execute
    oext, content = cls._execute(records, data, action_report)
  File "/trytond/modules/account_invoice/invoice.py", line 2493, in _execute
    result = super(InvoiceReport, cls)._execute(records, data, action)
  File "/trytond/report/report.py", line 203, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/report/report.py", line 302, in render
    data = rel_report(**report_context).render()
  File "/relatorio/templates/base.py", line 35, in render
    self.events, method=method, encoding=encoding, out=out)
  File "/relatorio/templates/opendocument.py", line 1169, in __call__
    self.xml_serializer(writer(stream)), encoding=encoding, out=writer)
  File "/genshi/output.py", line 58, in encode
    for chunk in iterator:
  File "/genshi/output.py", line 241, in __call__
    for kind, data, pos in stream:
  File "/genshi/output.py", line 671, in __call__
    for kind, data, pos in stream:
  File "/genshi/output.py", line 776, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "/genshi/output.py", line 596, in __call__
    for ev in stream:
  File "/relatorio/templates/opendocument.py", line 1061, in __call__
    for kind, data, pos in stream:
  File "/genshi/core.py", line 292, in _ensure
    for event in stream:
  File "/genshi/filters/i18n.py", line 691, in __call__
    for kind, data, pos in stream:
  File "/genshi/template/base.py", line 638, in _include
    for event in stream:
  File "/genshi/template/markup.py", line 327, in _match
    for event in stream:
  File "/genshi/template/base.py", line 598, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/genshi/template/base.py", line 289, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/genshi/template/eval.py", line 178, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "<string>", line 1182, in <Expression '__relatorio_escape_invalid_chars(format_currency(abs(line.invoice_taxes), invoice.party.lang, currency=invoice.currency))'>
TypeError: bad operand type for abs(): 'tuple'

Fault: bad operand type for abs(): 'tuple'

what am I doing wrong?

thanks again

It is a list you will have to iterate.

You can take the invoice report as a reference for that.

Sorry, I think I was wrong, I guess you are looking for this one. (InvoiceLine Taxes not InvoiceTaxes…)

Anyway you will have to iterate on the taxes in the same way. The solution probably will be the same.

thank you very much @josesalvador but i don’t understand “iterate on the taxes” im not programmer excuse my ignorance

You will obtain a list of taxes so you will have to iterate (one by one) all the taxes per product if you want to show them.

I guess that if you feel this is a task for a developer maybe you will have to look for a partner who helps you to customize the report.

The documentation you will need to know to accomplish this task is placed here.