Price ea on ODT ouput

Hi Team,
i have an problem and i hope you can help. I’m looking to have a “price ea” on our ODT template. All the given {line_price_htxx} and {object_xx} are not working.

in example for proposal:
SalesPrice for product is $100, manuell given Discount 10%, qty. 2

Needed ODT output
Price ea $90, Price total $180

Any idea if there is a “smart” solution ?

Thanks for your help !

Hello,

What is a Price EA ?

The lists of TAGs are there : https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template

For lines you have : {line_price_ht} {line_price_ht_locale}

Hi KSAR,
thank you for your feedback.
Price ea means Price each ( Selling price - discount ), because when i use the other line_xx it always summarize the amount if qty. is more then 1.

I’ve attaced a screen how i need it.

snip.png

Best regards

Hi,

Ok so you want a price per unit minus discount, this is not availlable by default.

Two choices :
1 - Add your own ODT TAG (see Other personalized tags) : https://wiki.dolibarr.org/index.php/Create_an_ODT_document_template
2 - Create a calculated line extrafiled that does the needed calculation

THe second one is easier if you are not realy conformtable with php.

1 Like

Hi,
I’m not familar with PHP and my last test to try to add own ODT TAG wasn’t successfull therefore option2 would be the best option but i have no idea how to do that :unhappy:

I tried two different ways:
a) to define a range/field with line_price_ht_locale at the ODT template and text formel ( line_price_ht / line_qty ) but it failed

b) an extra-field on product with Computed field but however it is not working on ODT output
Product Complementary attributes

ODT Form

snip2.png

ODT Output

snip3.png

However, it do not show any ouput on first line ( where i expected the price ea ), and also the other lines are, maybe OK but instead of showing the name of entry it show only entry itself.

Any idea how i can get this field adopted right into our ODT ?

Pièces jointes :