This posting is generally right. But the process advance payment with note items can only work if the value of the payment is the same as the note item.
In this case the note item has to be cleared and the line with the advance payment (posting key 19, general ledger indicator A) will be done automatically only with clearing of the note item.