Can't Use my custom invoice template

75 views
Skip to first unread message

Richmond Fiko

unread,
Aug 23, 2018, 6:28:08 PM8/23/18
to tryton
Hello,

I have a strange behavior in tryton 4.2 invoice module.
I create some custom invoice report template. All is OK when I try to print invoice in
different state until it come to posted state. At this state, the base invoice model is printed
for any template I try. Is it normal? How can I print my custom template when invoice is in posted state?

Cédric Krier

unread,
Aug 23, 2018, 6:46:05 PM8/23/18
to tryton
Hi,
It really depend on how you customized the report.
When you post an invoice, the system store a copy the report result. And
it use this copy for any further print.
If you do the override using a module, you must follow
https://tryton-readthedocs.readthedocs.io/projects/server/en/latest/topics/reports/index.html#replacing-existing-tryton-reports
This is to ensure that only one ir.action.report is linked to account.invoice.
Or you can just upload in the database another template on the default
report action.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Richmond Fiko

unread,
Aug 24, 2018, 2:32:06 AM8/24/18
to tryton
It is possible to bypass this behavior ?

> It really depend on how you customized the report.
> When you post an invoice, the system store a copy the report result. And
> it use this copy for any further print.

I explain: I have 3 invoice templates, each template must be print according to a special case. It is not interesting for to keep a default model... So I need to print my custom model when invoice is posted because accountants will use the invoice sequence to track its.

Nicolas Évrard

unread,
Aug 24, 2018, 3:37:38 AM8/24/18
to try...@googlegroups.com
* Richmond Fiko [2018-08-24 01:19:56]:

Hello,

> It is possible to bypass this behavior ?

Of course but it's a bit difficult and it's there because quite often
there is a legal requirement to be able to produce the invoices
exactly as they were produced originally.

> > It really depend on how you customized the report.
> > When you post an invoice, the system store a copy the report result. And
> > it use this copy for any further print.
>
> I explain: I have 3 invoice templates, each template must be print
> according to a special case. It is not interesting for to keep a
> default model...

You can still have a unique template containing your three templates
and a choice on the top of the file to choose the right template
from a value defined somewhere.

> So I need to print my custom model when invoice is posted because
> accountants will use the invoice sequence to track its.

I don't understand as sequences are not related to relatorio
templates.

--
Nicolas Évrard - B2CK SPRL
E-mail/Jabber: nicolas...@b2ck.com

Cédric Krier

unread,
Aug 24, 2018, 3:51:06 AM8/24/18
to tryton
On 2018-08-23 16:19, Richmond Fiko wrote:
> It is possible to bypass this behavior ?

Not really because it is a requirement in most of the countries to
always re-print the document as it was when posted.
Indeed Tryton takes the first action it found to print the invoice.
I filled https://bugs.tryton.org/issue7646 to improve the situation.
For now, the best is to have a single template with a big switch/case
for the three layout.
Reply all
Reply to author
Forward
0 new messages