ODT, line_product_label don't work

Hi, I’m trying to create an ODT template for invoices.
I’m using Dolibarr 3.1.1

I used the wiki instructions (http://wiki.dolibarr.org/index.php/Create_an_ODT_document_template), and I can place every tag in right place, but line_product_label doesn’t show. It just print “{line_product_label}”

Which is the correct tag for product label?

Also I need the number of line on invoice, like:
1 - product1 10 5 50
2 - product2 3 4 12
3 - product3 1 2 2

is there a tag for that or should I use personalizated tags into htdocs/core/substitutions/functions_mymodule.lib.php ??

Thanks in advance

I think one of the threads here had a solution for the numbering of the products. Try to search the forums here.

For the correct tag try to look in the sample template you have in the dolibarr sources. I dont remember where I saw it once.

Hi saxa.
I found templates, but no reference about product label.
Although, in the wiki there is a reference for product label tag

I need the label for my invoices.

I found that those tags are generated by: htdocs/includes/modules/facture/doc/doc_generic_invoice_odt.modules.php

they are inside an array.

I will explore code to see if I can add this missing tag and make it work

Ok, in Wiki it says I can use {line_product_label} but doesn’t work.

Also in file htdocs/includes/modules/facture/doc/doc_generic_invoice_odt.modules.php I see function get_substitutionarray_lines that generates the tags.
“line_product_label” is not in there.

I added it but doesn’t work either.
So far I tried:
line_product_label=>$line->product_label
line_product_label=>$line->label
line_product_label=>$line->product_libelle
line_product_label=>$line->libelle

How can I get the “label” into an ODT template?

I have no idea,I need to take a closer look at it.

bump!

I saw that ‘core/modules/facture/doc/doc_generic_invoice_odt.modules.php’ is responsible for creating ODT invoice.

Also I found that into llx_facturedet, there is a field named ‘rang’ that would be the numbering order that I’m needing for my ODT template.

Where should I add this field?
I can’t find the sql sentence that bring all data.

I mean, If I can modify the ‘lines’ array and add rang to it, it would be easier to use it with ODT templates.

You can’t do that with Dolibarr below 3.3 (the current experimental branch), because the yourmodule_completesubstitutionarray() function can only work on non-line substitutions.

For product lines, you must have Dolibarr >= 3.3 and use the following substitution function: yourmodule_completesubstitutionarray_lines(&$substitutionarray,$outputlangs,$object,$line)

This one will be called for each product/service and will provide you with the $line object.

This is a functionality that I implemented by myself, so I know it works because I thoroughly tested it :wink:

You can find more informations here:
http://wiki.dolibarr.org/index.php/Create_an_ODT_document_template#Other_personalized_tags_for_lines