Commit graph

1 commit

Author SHA1 Message Date
lvessiller-opendsi
4d07abf199
FIX #37658 - Add unit tests for TTC unit price rounding and add fixes for others objects (proposals, orders, invoices and contracts) (#39055)
* Test: add unit tests for TTC unit price rounding (#37658)

Covers the "unit price entered including tax" workflow (subtotal title, product
line, free line, no-op update, discount on all lines) for sale/purchase objects,
checking totals and that each line keeps its typed TTC value (subprice_ttc).

* Test - Make TTC rounding test portable across versions (guard subtotal step with method_exists)

* Test - Use non-deprecated module names in isModEnabled (order/invoice/contract)

* Fix #37658 Persist TTC unit price entry mode on order/invoice/contract and supplier proposal

A line entered with the unit price including tax keeps its typed value (subprice_ttc) and
computes totals from it, avoiding a 0.01 rounding drift on create, no-op edit and bulk actions.
Moves wasEnteredIncludingTax() to CommonObjectLine.

* Cast unit price to float on supplier proposal updateline (phan)

* FIX #37658 Preserve TTC unit price entry mode on clone (createFromClone)

* Pass socid (not object id) to SupplierProposal::createFromClone in TTC clone test

* Preserve TTC unit price entry mode on origin conversion and credit note

* Fix phan: cast pu_ht to float for Contrat::defineBuyPrice() argument

* Preserve TTC unit price entry mode on supplier order, invoice and proposal (socle, clone, conversion, line edit and bulk actions)

* Fix cast ht to float for CommandeFournisseur::updateline() argument

* Fix cast subprice_ttc to float in ContratLigne::update SQL (phan SqlInjection)

* Add TTC round-of-total stability tests

Cover MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND=1 (and _SUPPLIER=1) on fresh
customer and supplier objects with mixed HT/TTC lines: create, no-op,
clone and discount must not drift and must keep the entry mode.

* Preserve TTC entry mode when creating a contract from origin

* Add getPriceBaseType() and preserve TTC entry mode on proposal from origin

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-08-11 19:48:40 +02:00