'Set back the payments in \'posted\' or \'sent\' state, without deleting the journal entries.
Called when cancelling a bank statement line linked to a pre-registered payment.'

@api.multi
def unreconcile(self):

    for payment in self:
        if payment.payment_reference:
            payment.write({'state': 'sent'})
        else:
            payment.write({'state': 'posted'})
