Stock numbers does not add up

Dolibarr version 21.0.1 - docker image

My stock numbers does not add up, seems like it is counting invoices, and not quantity on invoices. Am I wrong, or is this a bug?

My “product” in question is a service, and I have enabled stockmanagement for services.
Looking at the stock tab for this service I see 5+12

It does not matter if I change the date on /product/stock/stockatdate.php?mode=future&productid=128 it is still always 5+12 - when will this change?

Using the API I get the same - /api/index.php/products/128/stock

{
  "stock_reel": -5,
  "stock_theorique": -12,
  "stock_warehouses": {
    "1": {
      "real": "-5",
      "id": "68"
    }
  }
}

Looking at related items I see 17 invoices, and 5+12 is 17. But 3 of those 17 invoices have the same service twice on them. So the numbers should be 20, not 17?
/product/stats/facture.php?showmessage=1&id=128

Is this a bug, or how do I get accurate stock numbers that adds up?

Here is my stock module configuration