Skip to content

Gross price not calculated in supplier orders #37649

@mannybiker

Description

@mannybiker

Bug

The gross price (price + VAT) is not calculated in supplier orders lines when the subprice_ttc field in the DB (table llx_commande_fournisseurdet) is at 0.

I don't know if this is a normal behavior but all my subprice_ttc values in my supplier's orders are at 0 in the DB.
This means that when in the class commonobject.class.php at line 5563 it tests if $line->subprice_ttc is empty it returns false (it is a string "0,0000" not empty) and do not recalculate the price.

I had to actually change this in order to fix the problem from this
if (empty($line->subprice_ttc) && $line->qty) {
to this
if ((empty($line->subprice_ttc) or $line->subprice_ttc == 0) && $line->qty) {

but I'am not sure this will not impact something elsewhere.

The problem was not present in version 22.0.0. Probably due to the deprecation of the use of $pu_ttc that has been substituted by $subprice_ttc.

Dolibarr Version

23.0.1

Environment PHP

8.0.30

Environment Database

No response

Steps to reproduce the behavior and expected behavior

  • Verify that in the table llx_commande_fournisseurdet the field subprice_ttc is at 0
  • Set the global variable MAIN_NO_INPUT_PRICE_WITH_TAX to 0 in order to shop TTC prices in the supplier's order page

Attached files

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis is a bug (something does not work as expected)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions