# Bug OP-18829 - Deleting a Time and Cost report results in an error

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-18829

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 17.1.0 |
| Observed in versions | 17.0.0 |
| Sprint | 17.1.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 17.0.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Oliver Günther |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

## **Steps to reproduce**

**Preconditions:**

  - User is logged in

  - User has permission to view and delete Time and Cost reports

**Steps:**

1.  Go to **Time and Costs**

2.  In the left sidebar, select an existing Time and Cost report

3.  Click **Delete**

## **What is the buggy behavior?**

After clicking **Delete**, the application redirects to:

`/cost_reports/<id>`

and shows:

> **\[Error 404\] The page you were trying to access doesn't exist or has been removed.**

The report is already deleted, but OpenProject still tries to open it.

## **What is the expected behavior?**

After deleting the report, the user should be redirected back to the **Time and Costs overview page**, not to the deleted report.

Relevant server log:

`method=GET path=/cost_reports/10 controller=CostReportsController action=show status=404` 

This shows that after deletion, OpenProject tries to open the deleted report instead of redirecting to the overview.

### Screenshots and other files

*<img class="op-uc-image op-uc-image_inline" src="/api/v3/attachments/918769/content">*

### Environment information

**OpenProject installation type**

Packaged installation (Local development using foreman)

**OpenProject version**

*v17.0.2*

**Browser**

- [x] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Mobile Safari
- [ ] Other (please specify)

**Operating System**

- [x] Windows
- [ ] Mac OS X
- [ ] Mobile iOS
- [ ] Mobile Android
- [ ] Linux (please specify distro)
- [ ] Chrome OS
- [ ] Other (please specify)

**Language:**  
Browser: Slovenian  
OpenProject user language: Slovenian
