(self)
return super(AccountPaymentMethodLine, unused_payment_method_lines).unlink()
Payment method lines which are used in a payment should not be deleted from the database,
        only the link betweend them and the journals must be broken.
Payment method lines which are used in a payment should not be deleted from the database,
        only the link betweend them and the journals must be broken.
Payment method lines which are used in a payment should not be deleted from the database only the link betweend them and the journals must be broken .
def unlink(self):
        """
        Payment method lines which are used in a payment should not be deleted from the database,
        only the link betweend them and the journals must be broken.
        """
        unused_payment_method_lines = self
        for line in self:
            payment_count = self.env['account.payment'].search_count([('payment_method_line_id', '=', line.id)])
            if payment_count > 0:
                unused_payment_method_lines -= line

        (self - unused_payment_method_lines).write({'journal_id': False})

        return super(AccountPaymentMethodLine, unused_payment_method_lines).unlink()
def unlink ( self ) : unused_payment_method_lines = self for line in self : payment_count = self . env [ 'account.payment' ] . search_count ( [ ( 'payment_method_line_id' , '=' , line . id ) ] ) if payment_count > 0 : unused_payment_method_lines -= line ( self - unused_payment_method_lines ) . write ( { 'journal_id' : False } ) return super ( AccountPaymentMethodLine , unused_payment_method_lines ) . unlink ( )