Skip to content

[18.0][MIG] privacy_partner_to_be_forgotten - #87

Closed
michelerusti wants to merge 14 commits into
OCA:18.0from
michelerusti:18.0-mig-privacy_partner_to_be_forgotten
Closed

michelerusti wants to merge 14 commits into
OCA:18.0from
michelerusti:18.0-mig-privacy_partner_to_be_forgotten

Conversation

@michelerusti

@michelerusti michelerusti commented Jun 11, 2025 •

Copy link
Copy Markdown
Contributor

migration of
#83

halbtonjazz and others added 13 commits June 11, 2025 18:01
Add initial draft of the GDPR anonymization module to comply
with the "Right to be Forgotten" for individual contact records
(res.partner).

Includes base structure, wizard logic, access control, and UI
integration for manual anonymization via action menu.

Task: 4518
Improve module implementation with demo data and code refinements:
- Add comprehensive demo data with test partners and users
- Refactor anonymization logic for better maintainability
- Update security groups with dedicated category
- Improve wizard UI and warning messages
- Fix mail.channel references to discuss.channel
- Add no_reset_password context for demo users
- Clean up docstrings and code formatting

Task: 4518
Improve XML formatting and context handling in the module:
- Add proper XML formatting
- Include active_test=False in partner anonymization context to handle
  archived records

These changes enhance code readability and ensure proper handling of both
active and archived partners during anonymization process.

Task: 4518
Add initial documentation for the module including:
- README and subpages (CONTEXT, USAGE, CONFIGURE, etc.)
- Contributors list in readme
- HTML description for Apps Store display
- Updated manifest summary for better clarity
- Added copyright headers

Task: 4518
Refactor anonymization logic to improve readability,
testability, and compliance with Odoo conventions.

Changes include:
- Extracted helper methods for email, messages, attachments
- Replaced datetime with fields.Datetime for consistency
- Improved logging and translation usage
- Rewrote _anonymize_partner_data into modular structure

Added extensive test coverage:
- Parent/child anonymization scenarios
- Company restriction handling
- Access rights validation
- Attachments/messages cleanup
- Multi-partner anonymization

Minor improvements:
- Removed unused demo import
- Removed optional manifest keys
- Added changelog section to docs

Task: 4518
Improve code documentation and formatting across multiple files to enhance
readability and maintainability:

- Add detailed docstrings to core anonymization methods
- Use named placeholders in translations for better clarity
- Add ensure_one() safety check to attachment domain method
- Improve code formatting and line length compliance
- Simplify default_get logic in wizard
- Enhance anonymization success message with count

Technical improvements:
- Use rf-strings for email regex patterns
- Standardize create() and search() formatting

Task: 4518
Update all license header URLs to correctly point to LGPL-3.0 instead of AGPL
across the module. This ensures consistency between the declared license
(LGPL-3.0) and its reference URL.

Files updated:
- Python files (__init__.py, __manifest__.py, models, tests, wizards)
- XML files (demo data, security, views)

This change improves legal accuracy and maintains proper license
documentation throughout the codebase.

Task: 4518
Improve module structure and maintainability through several changes:
- Replace XML demo data with programmatic test data creation
- Remove redundant browse call in user anonymization
- Add noupdate flag to demo data
- Remove copyright headers from XML files
- Update company name from "Cetmix OÜ" to "Cetmix"
- Fix license reference consistency (AGPL -> LGPL-3.0)
These changes make the module more maintainable and ensure consistent
naming and licensing across all files.

Task: 4518
Improve partner anonymization process and test coverage:
- Add tracking_disable context to prevent storing sensitive data
  in mail.tracking.value records during anonymization
- Add test to ensure no personal data remains in
  chatter after anonymization process

These changes ensure better privacy protection by preventing
any traces of personal information in the system logs and
tracking values.

Task: 4518
Enable anonymization of companies by adjusting the logic:
- Companies can now be anonymized by changing the name (add 'Anonymized' suffix)
  and archiving the partner record without clearing business-critical data.
- Deactivate portal users linked to companies instead of full anonymization.
- Remove the restriction that blocked anonymization of companies.
- Update wizard view and related tests to reflect the new behavior.

This change fixes an issue where attempts to anonymize a company
failed with a "Cannot anonymize company" error.

Task: 4518
Implement real-time UI updates during partner anonymization:
- Add bus notifications when messages and attachments are deleted
- Send notification when anonymization log message is created
- Add unit tests for notification sending functionality
- Improve error handling with empty collections

These changes ensure the UI is properly updated when a partner is
anonymized, providing better user experience by showing changes
immediately without requiring page refresh.

Task: 4518
Improve code quality and maintainability:
- Use DEFAULT_SERVER_DATE_FORMAT instead of hardcoded date format
- Update anonymized email format to use YYYY-MM-DD
- Refactor _anonymize_user method to reduce code duplication
- Use subtype_xmlid parameter instead of subtype_id in message_post
- Update tests to match new email format pattern

These changes improve code clarity, test reliability, and ensure
standardized formatting across anonymized data and logging messages.

Task: 4518
@michelerusti
michelerusti force-pushed the 18.0-mig-privacy_partner_to_be_forgotten branch from 3e57bfd to d8a2f29 Compare June 11, 2025 16:37
@michelerusti
michelerusti force-pushed the 18.0-mig-privacy_partner_to_be_forgotten branch from d8a2f29 to f4c5db8 Compare June 11, 2025 16:42
@michelerusti
michelerusti marked this pull request as ready for review June 11, 2025 16:44

@SerM11 SerM11 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Functional test: OK

@michelerusti michelerusti mentioned this pull request Jun 27, 2025
1 task
@OCA-git-bot

Copy link
Copy Markdown
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). 🤖

@michelerusti

Copy link
Copy Markdown
Contributor Author

@OCA/data-protection-maintainers could you take a look this PR please?

@ivs-cetmix

Copy link
Copy Markdown
Member

Hi @michelerusti, the module was merged in the main branch, please update or reopen your PR.

@michelerusti

Copy link
Copy Markdown
Contributor Author

@ivs-cetmix opened #92
Closing this one

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.

6 participants