Defect #43583
openTime spent are not transferred to a new project when a project is changed.
0%
Description
If you add the time spent to an issue in project "A" and then change the project of this issue to "B", then the time spent on this task is not displayed in project "B".
Changing the project:

Spent time:


Search for time spent on a task in project B:

I connected directly to the database, found a record of the time spent in the "time_entries" table and the correct project was specified in this record (project B = 242, A = 244).

Further down the "activity_id" field, I found an entry in the "enumerations" table, but it was associated with project A (244). For some reason, this field did not change the value to 242 (project B)

After manually changing the value of the "project_id" field from 244(A) to 242(B), the time spent is being searched:

My configuration:
Environment: Redmine version 6.0.6.stable Ruby version 3.3.8-p144 (2025-04-09) [x86_64-linux] Rails version 7.2.2.1 Environment production Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp Redmine settings: Redmine theme Default SCM: Subversion 1.14.2 Mercurial 6.3.2 Bazaar 3.3.2 Git 2.39.5 Filesystem Redmine plugins: additional_tags 4.0.0 additionals 4.0.0 redmine_custom_workflows 3.0.0 redmine_dashboard 2.16.0 redmine_reporting 4.0.0 redmine_unread_issues 1.1.0 redmine_wiki_text_colorizer 0.1.4
Files
Updated by Marius BĂLTEANU 4 days ago
- Status changed from New to Needs feedback
- Assignee set to Dmitry Seliverstov
I cannot reproduce on vanilla Redmine. Can you try without plugins?
Updated by Marius BĂLTEANU 4 days ago
Created a new issue and added a spent time:
redmine_development=# SELECT * FROM time_entries WHERE id = 7 ; id | project_id | user_id | issue_id | hours | comments | activity_id | spent_on | tyear | tmonth | tweek | created_on | updated_on | author_id ----+------------+---------+----------+-------+----------+-------------+------------+-------+--------+-------+----------------------------+----------------------------+----------- 7 | 1 | 1 | 16 | 4 | | 10 | 2026-01-01 | 2026 | 1 | 1 | 2026-01-01 17:23:30.878096 | 2026-01-01 17:23:30.878096 | 1 (1 row)
Changed issue project:
redmine_development=# SELECT * FROM time_entries WHERE id = 7 ; id | project_id | user_id | issue_id | hours | comments | activity_id | spent_on | tyear | tmonth | tweek | created_on | updated_on | author_id ----+------------+---------+----------+-------+----------+-------------+------------+-------+--------+-------+----------------------------+----------------------------+----------- 7 | 2 | 1 | 16 | 4 | | 10 | 2026-01-01 | 2026 | 1 | 1 | 2026-01-01 17:23:30.878096 | 2026-01-01 17:23:30.878096 | 1 (1 row)
Updated by Holger Just 4 days ago
For reference: The change of the project_id of the time entry this is implemented in Issue#after_project_change and has been in place since Redmine 0.6 (about 18 years ago).
However, what actually does not work here is changing the activity to the correct one for new project. This would be necessary if one of the projects uses a derived activity. Here, we would have to find the equivalent project activity of the new project and set it on each time entry (i.e. the activity with the same `parent_id` (if set) or id as in the source project. Without this, filters on the time entry activity in the new project could be invalid and not include the time entry with the invalid activity.
However, with just the approach shown by Dmitry above, this should not be visible in Redmine alone as it does not appear that he restricts the activity id, and it is not checked by default. This issue thus could indeed be caused by one of the plugins. There is a bug in Redmine nevertheless.