OdooWiki OCA HUB

Base Domain Inverse Function

base_domain_inverse_function folder_open OCA/server-tools open_in_new
Others License: AGPL-3

This module provides functions to decompose normalized domains into domains operands, as these functions are the inverse of AND and OR functions available in odoo.osv.expression.

auto_awesome What this module does

AI-generated from the code · Odoo 16.0

Adds helper functions that split a normalized Odoo search domain into its individual parts, so developers can modify one part and rebuild the domain.

This is a technical helper module with no screens, menus or user-facing features. It does not add any new business model or database table; it only provides Python functions that other modules or customizations can call.

The functions take a normalized search domain (the technical filter used to search records in Odoo) and break it back into a list of smaller domains, according to whether the main operator is AND or OR. This is the reverse of the standard Odoo functions that combine domains with AND or OR.

  • inverse_OR(domain) splits a domain whose main operator is OR.
  • inverse_AND(domain) splits a domain whose main operator is AND.
  • inverse_combine(domain, operator) does the work for a chosen operator.

Business rules and limits shown in the code: - Only the operators AND ('&') and OR ('|') are accepted; any other operator raises an error. - Domains containing the NOT operator ('!') are not supported and raise an error. - The input domain must be normalized, meaning the main operator must appear first.

Because it depends only on base and defines no models, it changes nothing visible in the Odoo interface. Its value is for developers who need to inject extra conditions into an existing domain before rebuilding it.

Depends on

base

Text generated by AI (DeepSeek) from reading the Odoo 16.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 2 confirmed, 7 with no information of 9 versions.

Sources · Odoo 13.0

Confirmed on 2026-11-03 in branch 13.0 of OCA/server-tools.

terminal Installation and usage

OCA documentation · Odoo 16.0

If you have to decompose a complex domain to inject some conditions, this shows what you can do:

from odoo.osv.expression import AND, OR
from odoo.addons.base_domain_inverse_function.expression import inverse_AND, inverse_OR

domain = AND([d1, d2, d3])
d1, d2, d3 = inverse_AND(domain)

domain = OR([d1, d2, d3])
d1, d2, d3 = inverse_OR(domain)

No verified information in OCA: Installation, Configuration.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.