[T6983] FIX account.payment.order columns total <-> paid. Improve code

Merged Macarena Meldi requested to merge 15.0-T6983 into 15.0

Merge request reports