Skip to content

[18.0][MIG] mail_activity_done: Migration to 18.0#31

Merged
OCA-git-bot merged 38 commits intoOCA:18.0from
StefanRijnhart:18.0-mig-mail_activity_done
May 9, 2025
Merged

[18.0][MIG] mail_activity_done: Migration to 18.0#31
OCA-git-bot merged 38 commits intoOCA:18.0from
StefanRijnhart:18.0-mig-mail_activity_done

Conversation

@StefanRijnhart
Copy link
Member

@StefanRijnhart StefanRijnhart commented Feb 12, 2025

Continued from #17

The functionality is now supported by Odoo, using a similar datamodel: to mark activities done, they are archived instead of unlinked. This is reflected in the way that the state field is computed.

We can keep this module to ensure that all activity types default to keeping done activities (which is not the case in Odoo). Otherwise, the migration script will also clear archived activities that were not done, to prevent them from showing up as 'done' in Odoo 18.

@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-mail_activity_done branch 2 times, most recently from 12447aa to 9e8cb5c Compare February 12, 2025 14:59
@StefanRijnhart StefanRijnhart changed the title [18.0][MIG] mail_activity_done: Migration to 18.,0 [18.0][MIG] mail_activity_done: Migration to 18.0 Feb 12, 2025
JordiBForgeFlow and others added 21 commits February 12, 2025 17:24
Changed property in test to a correct one

Changed README

Added necessary checks if module does not have an icon

Added default value to _original_module
Currently translated at 100.0% (15 of 15 strings)

Translation: social-16.0/social-16.0-mail_activity_done
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_activity_done/es/
Currently translated at 100.0% (15 of 15 strings)

Translation: social-16.0/social-16.0-mail_activity_done
Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_activity_done/it/
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-mail_activity_done branch from 550e961 to 4338c9c Compare February 12, 2025 16:24
@Bart-dh
Copy link

Bart-dh commented Mar 17, 2025

Isn't this default functionality in Odoo 18?
image

@StefanRijnhart
Copy link
Member Author

@Bart-dh Ooooh, nice find! I'll check if there is remaining functionality to keep, and if migration is required for done activities from earlier versions.

@StefanRijnhart StefanRijnhart marked this pull request as draft March 17, 2025 17:09
@StefanRijnhart StefanRijnhart marked this pull request as ready for review April 29, 2025 17:36
@StefanRijnhart StefanRijnhart marked this pull request as draft April 29, 2025 17:36
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-mail_activity_done branch 2 times, most recently from 03580ba to 1bf6bdb Compare April 29, 2025 18:28
@StefanRijnhart
Copy link
Member Author

@Bart-dh Thanks again! Indeed, Odoo 18 supports keeping done activities natively. I refactored the module to smoothen out the migration, and to ensure that the activity types in Odoo are always configured to keep done activities.

cc @hbrunn

@StefanRijnhart StefanRijnhart requested a review from hbrunn April 29, 2025 18:35
@StefanRijnhart StefanRijnhart marked this pull request as ready for review April 29, 2025 18:36
_set_keep_done(cr)
cr.execute(
"""
delete from mail_activity where active is not true and done is not true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is unexpected for me, what's your rationale here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All archived activites are considered done in Odoo 18: https://github.com/odoo/odoo/blob/44e61c6/addons/mail/models/mail_activity.py#L154

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but we're migrating the module that people install to keep activities, so I'd not expect its migration to delete anything. I'd expect the migration script to set active to False where done is True (even though the v17 code of this module should have set this in the first place)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, handling done activities that are still active is another inconsistency that might need handling. As for the other case, I downgraded that to a warning.

@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-mail_activity_done branch from 1bf6bdb to 2534fbe Compare May 2, 2025 10:01
The functionality is now supported by Odoo, using a similar datamodel: to mark
activities done, they are archived instead of unlinked. This is reflected in the
way that the state field is computed.
@StefanRijnhart StefanRijnhart force-pushed the 18.0-mig-mail_activity_done branch from 2534fbe to 8b1ad5d Compare May 2, 2025 11:42
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@hbrunn
Copy link
Member

hbrunn commented May 9, 2025

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-31-by-hbrunn-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit cea5beb into OCA:18.0 May 9, 2025
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 7ec8ce2. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comments