magento2 – credit memo total line got a bad record

I have an order O1, with multiples products.
THe products P1 has been refunded from the order.
The totals are fine if we are just looking at the refund amount and the order.

But, here comes the issue, usually, if you want to create a credit memo on the same order O1 with a product P2; on the opening form, you will the that one of your product got already refunded, so the total line will be 0.

But sadly, on that specific refund (and only that one, I don’t have issue in the code). The total line didn’t took the value 0; so as, it still count the first product price amount in the second product refund…which shouldn’t be.

So I’m looking for a way to modify directly that value from the database; but I don’t know where to look at.

As you can see there, the last line should be 0 as it was already refunded (the subtotal and so on in the bottom is also wrong because of that)

totals

So here is my issue : What table should I alter to update that total line value ?

This is what I have in my sales order item table…it sounds good to me

qty refund

May be the issue comes from the fact that the amount refunded is still noticed as 0 ? But i’m not sure

amount