Line tag for Extra Field ODT

Hello!
Is there a option for making “Line tags” for extra field in ODT template?

Hi

To display the extra field in the ODT should put the TAG {object_options_xxx}: Value of extra field (where xxx is code of extra field)

Regards
Nikos

Thanks!
but that’s only for Object TAG not for LINE tag?

“Line” Tag its for repeating in the Invoice line
“Object” its for the header in Invoice or Order etc…

So Object_option_xxx its oki, but its non tag for Line_option_xxxxxxx

Hello Knut !

I see what you mean but you almost gave the answer… line_options_xxx ?

If it doesn’t work it means it is not activated, and the code hasn’t been implemented to support such line options on a “per line” basis…

a “line” is a product with an “extrafield” for you ?
and you want to display the exrtrafield (the one you set in the product card… for exemple) of the product on the ODT of propal, order, invoice ?

line_options_xxx dont work!!

if you make a Complementary attributes field in " Complementary attributes (lines) "
then make a field called “testing”
then on ODT template make {line_options_testing} in row it don’t work!!!

Hey Knut, do you try to display attributes “per each line” = for “each product” ?
complementary atttributes are set up where ? can you post some screenshot where you set up the compl. attribute ?

On the “setup” module “Customer Orders”
Then the Tab
“Complementary attributes (lines)”
Se pictures?

Hi there,

Could anyone offer some guidance on how I could “teach” Dolibarr a new line tag for odt?

Like Knut, I have created a complementary line attribute with Extrafields. I have also created the very same attribute with CustomFields as I thought CustomFields might be doing what I need without further action.

However, apparently it is not that easy and as my coding ability is very limited, I am a little bit stuck. I did understand from the documentation how to define a new odt tag and apparently also how to define a new line tag, but I do not understand how to tell Dolibarr to take the value for it from the complementary Extrafields attribute or the CustomFields attribute (either would solve my problem).

How can I do this? A “dirty” way would be fine to me.

Thank you!

Stil not working in 3.7.1 :wink:
hope you gays can fix this soon!!

Hello,
I am trying to add to my invoice template a products messured unit.
For my case its KILOS or PIECES
I made a new complementary attribute at products named code “producttypeis”
Now i want to pass that at the odt template

Product Unite Mesurment
Cool Product one KILOS
Coller Product two PIECES

in the code i write

Product Unite Mesurment
[!-- BEGIN row.lines --]{line_product_ref} {object_options_producttypeis}[!-- END row.lines --]

But this only returns at the unite mesurment column this “{object_options_producttypeis}”
The same like it doesnt recognise it.
I read at the help file
[spoiler] Other personalized tags for lines

This function is available since Dolibarr v3.3 (future development version).

Similarly to the previous chapter, you have to define a function, and it works about the same, but with a few twists:

Create or edit the same file as before (see the previous chapter).
Here are the twists: in the file, write another function with almost the same name but with '_lines' appended, and also add a new $lines variable: 

/** Function called to complete substitution array for lines (before generating on ODT, or a personalized email)
* functions xxx_completesubstitutionarray_lines are called by make_substitutions() if file
* is inside directory htdocs/core/substitutions
*

  •  @param	array		$substitutionarray	Array with substitution key=\>val
    
  •  @param	Translate	$langs			Output langs
    
  •  @param	Object		$object			Object to use to get values
    

* @param Object $line Current line being processed, use this object to get values
* @return void The entry parameter $substitutionarray is modified
*/
function mymodule_completesubstitutionarray_lines(&$substitutionarray,$langs,$object,$line) {
{
global $conf,$db;

$myvalue=‘Put here calculated value to insert’;
$substitutionarray[‘myowntag’]=$myvalue;
}

Contrary to the previous function which was called only once, this function will be called everytime a line of product will be processed, giving you each time a new $line object that you can process. This allows you to do different substitutions for each product. [/spoiler]

So I suspect I must put something here “‘Put here calculated value to insert’”
But I dont know what

Hello
Resolved for me.
I had the same problem with an extra field line with a code qttlivm. when I try to use {line_options_qttlivm} it doesn’t show the value of that extra field line on the ODT generated document.

I found that the problem was related to the hidden code in the ODT document. When you paste the name of the extra-field it add other tags in the template.

To resolve this issue try to delete all what you have in the cell line and type directly the name of the extra-field line like {line_options_xxx} where xxx is the code of your extra-field line as described in the documentation (not use paste function).

1 Like