Create new report (invoice) odt

I’m trying to create a custom invoice template for my company, I need various types. Under
Administration > UI > Actions > Reports I downloaded “invoice.odt”, did some changes, created a new report and applied keywords as in the original.

But now, when trying to create a customer invoice, the new template does not show up as a choice. The above form lacks the “path” box - is that the problem, and how can I resolve it?

Cheers,
Wolf

Hello @herrdeh

Look Invoice Report here and override this .

Hi, thanks for your quick answer. Sorry, I don’t understand a word. Could you be more dummie-compatible, please ? (-;

You must not duplicate the report record but just upload the modified template on the current report record. Tryton will store the custom version and use it instead of the standard.
This is the proper way when customizing from the user interface.

1 Like

@ ced
Well, I understood that. But actually I’d like to have differently looking templates - one for company customers, one for private customers. How can I achieve that?

read …
https://tryton-documentation.readthedocs.io/en/latest/developer_guide/basic_concepts.html
http://docs.tryton.org/projects/server/en/latest/topics/views/extension.html

Inside the same template, you can put both layouts inside two big <choose/>.

Ah great,m I’ll try.

Sorry, it’s me again. Please be dummy- and noob-proof. :roll_eyes:

  • How can I upload a fodt file in the UI?
  • How can I determine where a layout starts and ends?

Please excuse my noobishness…

By using the select button on the data field (you have to remove content first), see image

I’m not sure to understand the question.
But I guess your layout will look like (pseudo-code):

<choose>
<when test="invoice.party.is_company">
layout company
</when>
<otherwise test="">
other layout
</otherwise>
</choose>

Yet another question around this topic:
How can i test my fodt drafts without creating a “real” invoice every time? - I guess I’ll need something like >100 attempts till I get what I want.

You can print a draft invoice before posting it. Every print version will use the current template value, so if you update it you will see on the draft invoice.

Once the invoice is posted a copy of the invoice is stored on the database, so you must clear this copy in order to regenerate it.

Tks a lot, Master Pokoli.
So I tried the right thing, but always got this error message:

Traceback (most recent call last):
  File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 108, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 48, in rpc
    request, database_name, *requestrpc_params)
  File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 76, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python37/dist-packages/trytond/protocols/wrapperspy", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 186, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python37/dist-packages/trytond/modules/account_invoice/invoicepy", line 2518, in execute
    result = super(InvoiceReport, cls)execute(ids, data)
  File "/usr/local/lib/python37/dist-packages/trytond/report/reportpy", line 195, in execute
    oext, content = cls_execute(records, data, action_report)
  File "/usr/local/lib/python37/dist-packages/trytond/modules/account_invoice/invoicepy", line 2499, in _execute
    result = super(InvoiceReport, cls)_execute(records, data, action)
  File "/usr/local/lib/python37/dist-packages/trytond/report/reportpy", line 203, in _execute
    return clsconvert(action, clsrender(action, report_context))
  File "/usr/local/lib/python37/dist-packages/trytond/report/reportpy", line 302, in render
    data = rel_report(**report_context)render()
  File "/usr/local/lib/python37/dist-packages/relatorio/reportingpy", line 121, in __call__
    template = selftmpl_loaderload(selffpath, selfmimetype)
  File "/usr/local/lib/python37/dist-packages/relatorio/reportingpy", line 81, in load
    path, cls=cls, relative_to=relative_to)
  File "/genshi/template/loaderpy", line 236, in load
    filename, encoding=encoding)
  File "/genshi/template/loaderpy", line 274, in _instantiate
    allow_exec=selfallow_exec)
  File "/usr/local/lib/python37/dist-packages/relatorio/templates/opendocumentpy", line 267, in __init__
    encoding, lookup, allow_exec)
  File "/genshi/template/markuppy", line 67, in __init__
    allow_exec=allow_exec)
  File "/genshi/template/basepy", line 418, in __init__
    self_stream = self_parse(source, encoding)
  File "/usr/local/lib/python37/dist-packages/relatorio/templates/opendocumentpy", line 294, in _parse
    styles = template_parse(selfinsert_directives(styles), encoding)
  File "/usr/local/lib/python37/dist-packages/relatorio/templates/opendocumentpy", line 347, in insert_directives
    self_handle_relatorio_tags(tree)
  File "/usr/local/lib/python37/dist-packages/relatorio/templates/opendocumentpy", line 459, in _handle_relatorio_tags
    r_statements, closing_tags = self_relatorio_statements(tree)
  File "/usr/local/lib/python37/dist-packages/relatorio/templates/opendocumentpy", line 434, in _relatorio_statements
    assert not opened_tags
AssertionError

Fault:

This means that there is an error on your template file.
Normally this is because there is an opened tag (if, for, choose) which does not have it’s corresponding closing tag (/if, /for, /choose)

Allright. Got it.
Cheers for your patience!

A post was split to a new topic: How to adapt report based on party being memeber of a category

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.