Autodecrease stock on invoice validation but not for particular type of invoice

So in the stock module, we have set “Decrease real stocks on validation of customer invoice/credit note” and it is working perfectly.

However, we want a particular type of invoice to avoid a stock decrease on validation. The difference will be the “Payment Type” of the invoice. I.e., when the payment type is set to “Consignee” (or we can use the record ID from llx2_c_payment_term) the stock SHOULD NOT be decreased.

Does anyone know where the actual SQL query decreasing the stock is? The above can be easily achieved with 1 line of WHERE clause, but I cannot find the query decreasing the stock.

Or if you can advise another approach to do this.