- All products
- View Multicompany Country Filter
- All products
L10n Country Filter
Dynamic Localization UI Cleaner. Optimize your Odoo forms by automatically hiding irrelevant fields based on the country of the active company. Essential for global multi-company environments.
What are we solving?
Multi-Country Clutter
In multi-company environments (e.g. Peru + USA), users often see irrelevant fields such as 'Ubigeo' or 'RUC' while operating in the USA. This causes confusion and data-entry errors.
Context-Aware Hiding
This module intelligently detects the country of the current company and dynamically hides the fields that do not belong there. Your forms stay clean and 100% relevant to the legal context.
Technical Implementation Guide
This is a technical library module. To use it, inherit the Mixin and implement the logic in the _get_view method.
class ResPartner(models.Model):
_inherit = ['res.partner', 'l10n.country.filter.mixin'] # Required Mixin
@api.model
def _get_view(self, view_id=None, view_type='form', **options):
arch, view = super()._get_view(view_id, view_type, **options)
peru = self.env.ref('base.pe', raise_if_not_found=False)
if not peru: return arch, view
# Apply the filter: hide tags if the country is NOT Peru
arch, view = self._tags_invisible_per_country(
arch, view, view_type,
tags=['l10n_pe_vat_code', ('group', 'l10n_pe_group_vat')],
countries=[peru]
)
return arch, view
CRITICAL: Inheriting l10n.country.filter.mixin is required to correctly handle the per-company (company_id) view cache in Odoo 19.
Enterprise Validation Plan
When switching from Company A (Peru) to Company B (USA), the restricted fields must disappear from the form instantly, without manually refreshing the page.
In list views, the header of the restricted column must be hidden using column_invisible, avoiding unnecessary blank space in the interface.
Verification that the Odoo cache does not "leak" fields between companies because of a shared cache key. Each company keeps its own view architecture.
FAQ & Troubleshooting
The fields are not being hidden. What is happening?
Check that the country of the current company is set in Settings > Companies. If the country matches the list allowed in the code, the field will remain visible.
Does it work with Odoo Studio?
No. This is a Python code-level utility (Controller/Model). Odoo Studio applies static changes to the XML, whereas this module invokes dynamic logic before the view is served.
Is it compatible with Multi-Website?
Yes. The logic is tied to the company_id of the user in session, which makes it safe for backend operations in multi-site setups.
Commercial & Sales
Technical Advisory
WHATSAPP+1 828 672 6150Solicitar Soporte
LEADSleads@ganemo.comGanemo Developer Support
Do you need help implementing this logic in complex models, or support migrating views to Odoo 19?
TICKETayuda@ganemo.comL10n Country Filter
Dynamic Localization UI Cleaner. Optimize your Odoo forms by automatically hiding irrelevant fields based on the country of the active company. Essential for global multi-company environments.
What are we solving?
Multi-Country Clutter
In multi-company environments (e.g. Peru + USA), users often see irrelevant fields such as 'Ubigeo' or 'RUC' while operating in the USA. This causes confusion and data-entry errors.
Context-Aware Hiding
This module intelligently detects the country of the current company and dynamically hides the fields that do not belong there. Your forms stay clean and 100% relevant to the legal context.
Technical Implementation Guide
This is a technical library module. To use it, inherit the Mixin and implement the logic in the _get_view method.
class ResPartner(models.Model):
_inherit = ['res.partner', 'l10n.country.filter.mixin'] # Required Mixin
@api.model
def _get_view(self, view_id=None, view_type='form', **options):
arch, view = super()._get_view(view_id, view_type, **options)
peru = self.env.ref('base.pe', raise_if_not_found=False)
if not peru: return arch, view
# Apply the filter: hide tags if the country is NOT Peru
arch, view = self._tags_invisible_per_country(
arch, view, view_type,
tags=['l10n_pe_vat_code', ('group', 'l10n_pe_group_vat')],
countries=[peru]
)
return arch, view
CRITICAL: Inheriting l10n.country.filter.mixin is required to correctly handle the per-company (company_id) view cache in Odoo 19.
Enterprise Validation Plan
When switching from Company A (Peru) to Company B (USA), the restricted fields must disappear from the form instantly, without manually refreshing the page.
In list views, the header of the restricted column must be hidden using column_invisible, avoiding unnecessary blank space in the interface.
Verification that the Odoo cache does not "leak" fields between companies because of a shared cache key. Each company keeps its own view architecture.
FAQ & Troubleshooting
The fields are not being hidden. What is happening?
Check that the country of the current company is set in Settings > Companies. If the country matches the list allowed in the code, the field will remain visible.
Does it work with Odoo Studio?
No. This is a Python code-level utility (Controller/Model). Odoo Studio applies static changes to the XML, whereas this module invokes dynamic logic before the view is served.
Is it compatible with Multi-Website?
Yes. The logic is tied to the company_id of the user in session, which makes it safe for backend operations in multi-site setups.
Commercial & Sales
Technical Advisory
WHATSAPP+1 828 672 6150Solicitar Soporte
LEADSleads@ganemo.comGanemo Developer Support
Do you need help implementing this logic in complex models, or support migrating views to Odoo 19?
TICKETayuda@ganemo.comSpecifications
| Version | 19.0, 20.0 |