Contract rows (Services) error

Good morning,
Managing contracts, inserting a new service, unit cost, quantity and discount, the first time it calculates the amount correctly.
Example: Cost 60, quantity 24, discount 15% the final result is correct and is equal to 1224 euros

If, at a later time, I modify the service, for example by modifying the description, the total is recalculated on the total value.
Example: 60x24 -15% = 1224, the system goes back to reapply the discount and in fact recalculates 1224 -15% =1040.4

I have done dozens of tests to understand where the error is, without success
The problem occurs constantly

Thank you

Context :
Centos 6
Dolibarr 18.0.6
Php 7.3
MySql
Libreoffice 4.4 Headless

can you provide some pictures? that would make it easier to understand

0_template_contract_Test.pdf (26.6 KB)
1_CT2504-0169_contract_CORRECT.pdf (26.9 KB)
2_CT2504-0169_contract_WRONG.pdf (27.2 KB)

Here are the example of wrong price calcolation :
0. The ODT template

  1. The file generated the first time
  2. the file generated afet modify, validate and generate

I am not capable of helping you, it is not a part of Dolibarr I use. I notice you run Dolibarr version 18.0.6. Version 21 was just released, so perhaps try upgrading?

Thank You
I understand, but from 18 to 19 i’ve problems with additional components and php 8.2 but i’m working on IT