After creating a sales invoice from an order or a prepayment invoice, the back office updates the payment status of the order or the prepayment invoice.
After deleting a payment, the back office updates the payment status of the associated invoice and its source documents.