Skip to content
Odoo Migration

Odoo Migration: Handling Custom Security Groups and Access Rights

A practical guide for CIOs and ERP consultants on migrating custom security groups, access rights, and record rules in Odoo. Learn how to audit, map, test, and validate security configurations to prevent data exposure and operational disruption during version upgrades.

8 min readSysGenPro Editorial
Odoo Migration: Handling Custom Security Groups and Access Rights

Direct Answer: Auditing and Mapping Security Configurations is Critical

Handling custom security groups and access rights during an Odoo migration requires a rigorous audit of all model-level and record-level permissions before, during, and after the upgrade. Unlike standard data, security configurations are deeply embedded in the database schema and custom module code, meaning they do not always migrate seamlessly. The primary risk is silent failure: a user may appear to have access, but record rules may be broken, leading to data leakage or operational blockages. To mitigate this, organizations must treat security migration as a distinct workstream, involving a full inventory of groups, a mapping of dependencies, and comprehensive regression testing in a staging environment. This approach ensures that role-based access control (RBAC) remains intact, protecting sensitive financial and operational data while maintaining business continuity.

Preparation: Inventorying Custom Security Assets

The first step in any Odoo migration is a comprehensive inventory of security assets. This involves identifying all custom security groups defined in XML or Python files within custom modules. You must distinguish between groups that inherit from standard Odoo groups and those that are entirely custom. Additionally, you need to catalog all access rights (ir.model.access) and record rules (ir.rule) associated with these groups. This inventory should be documented in a security matrix that maps each user role to the specific models and fields they can access. This documentation serves as the baseline for validation post-migration. Without this baseline, it is impossible to detect if permissions have been inadvertently widened or restricted during the upgrade process.

Identifying Dependencies and Inheritance

Security groups in Odoo often rely on inheritance. A custom group might inherit from a standard group like 'base.group_user' or 'account.group_account_manager'. During a version upgrade, the structure of standard groups may change, or new sub-groups may be introduced. If a custom group inherits from a group that has been deprecated or renamed in the target version, the migration may fail or result in broken permissions. You must analyze the dependency tree of each custom group to identify any reliance on standard groups that may have changed. This requires reviewing the official Odoo release notes for the specific source and target versions to understand any changes to the security framework. Compatibility and support must be verified against the vendor's official documentation for the exact source and target versions.

Technical Execution: Migrating Security Definitions

During the technical execution phase, security definitions are migrated along with the rest of the module code. For custom modules, this typically involves updating the XML files that define groups, access rights, and record rules. If you are using Python code to dynamically create or modify security rules, you must ensure that the APIs used are compatible with the target Odoo version. Deprecated APIs for security management may have been removed or changed, requiring code refactoring. It is crucial to test these changes in a development environment first. Do not assume that all custom modules, integrations, or databases can migrate automatically. Each custom security definition must be reviewed for compatibility with the new version's security engine.

Handling Record Rules and Domain Expressions

Record rules are particularly sensitive to migration because they rely on domain expressions that reference model fields. If a field name or type changes in the target version, the record rule may break, causing users to see no data or, worse, all data. You must review all record rules to ensure that the fields referenced in the domain expressions still exist and have the same data types. Additionally, check for any use of user context variables, such as 'user.company_id', which may behave differently if the multi-company setup has changed. Testing these rules with representative data is essential to verify that data segregation is maintained correctly.

Validation: Testing Security Configurations

Validation is the most critical phase for security migration. You must perform comprehensive regression testing to ensure that all access rights and record rules function as intended. This involves creating test users for each custom security group and verifying their access to various models and records. You should test both positive cases (users can access what they should) and negative cases (users cannot access what they should not). Automated testing scripts can be used to validate access rights at scale, but manual testing is still necessary for complex business scenarios. Focus on high-risk areas such as financial data, customer information, and administrative settings. Any discrepancies found during testing must be documented and resolved before proceeding to the production environment.

Test TypeDescriptionKey Checkpoints
Model Access TestVerify if a user can create, read, write, or delete records for a specific model.Check ir.model.access entries for each group and model.
Record Rule TestVerify if a user can only see records that match the domain expression.Test with multi-company data and user-specific filters.
Field Security TestVerify if specific fields are hidden or read-only for certain groups.Check field-level permissions in the UI and API.
Inheritance TestVerify that custom groups correctly inherit permissions from standard groups.Ensure no broken links to deprecated standard groups.

Deployment: Cutover and Go-Live

During the cutover phase, the migrated security configurations are applied to the production environment. This should be done as part of a controlled deployment process, with a clear rollback plan in place. Before going live, perform a final security audit to ensure that no unauthorized changes have been made. Communicate the cutover schedule to all stakeholders, including IT, finance, and operations teams. Monitor the system closely during the first few hours after go-live for any security-related errors or user complaints. Have a dedicated support team on standby to address any immediate issues. The go/no-go decision should be based on the results of the validation phase and the readiness of the support team.

Stabilization: Post-Migration Monitoring

After the migration is complete, the stabilization phase involves monitoring the system for any lingering security issues. This includes reviewing error logs for any access denied exceptions that may indicate broken permissions. Collect feedback from users to identify any areas where access rights may be too restrictive or too permissive. Make adjustments as needed and document any changes. Continue to monitor the system for a defined period, such as two to four weeks, to ensure that the security configuration is stable. This phase is crucial for catching any issues that may not have been detected during testing. It also provides an opportunity to refine the security configuration based on real-world usage patterns.

Risk Management: Mitigating Security Failures

The primary risks associated with migrating custom security groups are data leakage, operational disruption, and compliance violations. Data leakage can occur if record rules are broken, allowing users to access data they should not. Operational disruption can occur if users are unable to access the data they need to perform their jobs. Compliance violations can occur if the security configuration does not meet regulatory requirements, such as GDPR or SOX. To mitigate these risks, implement a robust risk management plan that includes regular security audits, automated testing, and a clear incident response process. Ensure that all security changes are documented and approved by the appropriate stakeholders. Regularly review and update the security configuration to reflect changes in business processes and regulatory requirements.

Best Practices for Long-Term Security Maintenance

To ensure long-term security maintenance, establish a governance framework for managing security configurations. This includes defining roles and responsibilities for security management, establishing a change management process for security changes, and conducting regular security audits. Use version control to track changes to security definitions and ensure that all changes are reviewed and approved. Automate the testing of security configurations to ensure that they remain consistent across environments. Provide training to users and administrators on best practices for managing security configurations. By following these best practices, you can ensure that your Odoo system remains secure and compliant over time.

Conclusion: Prioritizing Security in ERP Migration

Handling custom security groups and access rights is a critical aspect of any Odoo migration. By following a structured approach that includes inventorying, mapping, testing, and validating security configurations, you can mitigate the risks of data leakage and operational disruption. Treat security migration as a distinct workstream, with dedicated resources and a clear plan. Use automated tools to assist with testing and validation, but do not rely solely on them. Manual testing and user feedback are essential for catching complex issues. By prioritizing security in your migration strategy, you can ensure that your Odoo system remains secure, compliant, and reliable after the upgrade.

Written by
SysGenPro Editorial

SysGenPro Editorial

Platform & solutions team

Practical guidance on ERP, AI automation, cloud deployment and enterprise transformation from the SysGenPro team.

Share this article

Frequently asked questions

Common questions on this topic. Talk to our team for anything specific to your business.

01Do custom security groups migrate automatically in Odoo?

Custom security groups defined in XML files within custom modules are migrated as part of the module upgrade process. However, they do not migrate 'automatically' in the sense that they are guaranteed to work without changes. You must verify that the groups, access rights, and record rules are compatible with the target version. If the underlying standard groups or model fields have changed, the custom security definitions may need to be updated.

02How do I test access rights after an Odoo upgrade?

You should create test users for each custom security group and verify their access to various models and records. Test both positive and negative cases to ensure that users can access what they should and cannot access what they should not. Use automated testing scripts for scale, but also perform manual testing for complex business scenarios. Focus on high-risk areas such as financial data and customer information.

03What happens to record rules during a version change?

Record rules are stored in the database and are migrated along with the rest of the data. However, if the fields referenced in the domain expressions have changed in the target version, the record rules may break. You must review all record rules to ensure that the fields still exist and have the same data types. Test these rules with representative data to verify that data segregation is maintained.

04How can I prevent data exposure during ERP migration?

Prevent data exposure by performing a thorough audit of all security configurations before the migration. Map all custom security groups and access rights to a baseline. Test these configurations in a staging environment with representative data. Ensure that record rules are correctly applied and that no unauthorized access is possible. Monitor the system closely after the migration for any security-related errors.

05What is the best way to document Odoo security configurations?

The best way to document Odoo security configurations is to create a security matrix that maps each user role to the specific models and fields they can access. Include details on custom security groups, access rights, and record rules. Keep this documentation up to date as changes are made. Use version control to track changes to security definitions and ensure that all changes are reviewed and approved.

06Can I use automated tools to audit Odoo security?

Yes, you can use automated tools to audit Odoo security. These tools can scan the database for access rights and record rules and compare them against a baseline. They can also test access rights for different user groups. However, automated tools should be used in conjunction with manual testing to ensure that complex business scenarios are covered.

Continue learning
View all articles
Explore the platform

Where to go next

Browse the knowledge hub

See how SysGenPro fits your business

Discuss your workflows, modules and deployment options with our team.

Back to resources