Skip to content

[14.0][ADD] base_anonymize #346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ odoo_test_flavor: Both
odoo_version: 14.0
org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups: []
rebel_module_groups:
- base_anonymize
repo_description: 'TODO: add repo description.'
repo_name: server-backend
repo_slug: server-backend
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ jobs:
matrix:
include:
- container: ghcr.io/oca/oca-ci/py3.6-odoo14.0:latest
include: "base_anonymize"
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.6-ocb14.0:latest
include: "base_anonymize"
name: test with OCB
makepot: "true"
- container: ghcr.io/oca/oca-ci/py3.6-odoo14.0:latest
exclude: "base_anonymize"
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.6-ocb14.0:latest
exclude: "base_anonymize"
name: test with OCB
makepot: "true"
services:
Expand All @@ -49,6 +58,9 @@ jobs:
POSTGRES_DB: odoo
ports:
- 5432:5432
env:
INCLUDE: "${{ matrix.include }}"
EXCLUDE: "${{ matrix.exclude }}"
steps:
- uses: actions/checkout@v4
with:
Expand Down
151 changes: 151 additions & 0 deletions base_anonymize/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
====================
Anonymize a database
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d6665bbbd4558ee55b7df21a0f8c3e951364ac9c4b1a8305ed804a2f79b6bc7d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
:target: https://github.com/OCA/server-backend/tree/14.0/base_anonymize
:alt: OCA/server-backend
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-backend-14-0/server-backend-14-0-base_anonymize
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-backend&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module provides a flexible mechanism and default configuration for
anonymizing data in an Odoo database.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

This module was developed because the OCA internal tools workgroup needs
access to the OCA database, but shouldn't have access to the data of OCA
members.

It should be useful in any setting where external developers need access
to a database, or for setting up test instances.

Configuration
=============

To configure this module, you need to:

1. Go to Settings / Technical / Anonymization / Field Definitions
2. Review fields to overwrite, every field can be overwritten by some
method, and the overwritten records can be restricted by a domain

Usage
=====

To use this module, you need to:

1. Go to Settings / Technical / Anonymization / Run Anonymization
2. Confirm you really mean it

The above is only for testing configurations, usually you would script
this in some export setting by installing the module on a clone,
possibly a custom module modifying the field configuration, and running
the code ``env['anonymize.wizard'].action_run()`` before you export your
file store and dump the database to wherever you need it.

**!!CAUTION!!** The default configuration overwrites the database secret
and sets all passwords to ``password`` - for your tests, you will want
to disable the field definitions for ``res.users`` and
``ir.config_parameter``, because you'll be logged out after the
anonymization run otherwise.

Known issues / Roadmap
======================

- add more anonymization methods to generate syntactically correct data
like IBANs, phone numbers, ...
- write the same data on related fields
- add definitions for all relevant OCA modules

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_anonymize%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Hunki Enterprises BV

Contributors
------------

- Holger Brunn <[email protected]>
(https://hunki-enterprises.com)

Other credits
-------------

The list of fictional characters was generated from
`wikidata.org <https://query.wikidata.org>`__ using query:

::

SELECT ?item ?itemLabel WHERE {
?item (p:P31/ps:P31/(wdt:P279*)) wd:Q95074.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-hbrunn| image:: https://github.com/hbrunn.png?size=40px
:target: https://github.com/hbrunn
:alt: hbrunn

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-hbrunn|

This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/14.0/base_anonymize>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions base_anonymize/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
25 changes: 25 additions & 0 deletions base_anonymize/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2025 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

{
"name": "Anonymize a database",
"summary": "Overwrite all privacy relevant data in a database",
"version": "14.0.1.0.0",
"development_status": "Alpha",
"category": "Tools",
"website": "https://github.com/OCA/server-backend",
"author": "Hunki Enterprises BV, Odoo Community Association (OCA)",
"maintainers": ["hbrunn"],
"license": "AGPL-3",
"depends": [
"base",
],
"data": [
"data/anonymize_field.xml",
"data/anonymize.method.fictional.character.data.csv",
"security/ir.model.access.csv",
"views/anonymize_field.xml",
"wizards/anonymize_wizard.xml",
"views/menu.xml",
],
}
Loading