Skip to Content

View Multicompany Country Filter

L10n Country Filter: view_multicompany_country_filter
Dynamic UI cleanup for localization
Clean up your Odoo forms by automatically hiding the fields that are irrelevant to your country. A must-have for multi-country setups.
$ 0.00 $ 0.00
S/ 0.00

  • Version
Terms and Conditions
30-day money-back guarantee
Shipping: 2-3 Business Days
Technical Library & UI UX

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.

from odoo import models, api

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

TEST 01Multi-Company Context:

When switching from Company A (Peru) to Company B (USA), the restricted fields must disappear from the form instantly, without manually refreshing the page.

TEST 02List (Tree) Integrity:

In list views, the header of the restricted column must be hidden using column_invisible, avoiding unnecessary blank space in the interface.

TEST 03Cache Reliability:

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 6150
Solicitar Soporte
LEADSleads@ganemo.com

Ganemo Developer Support

Do you need help implementing this logic in complex models, or support migrating views to Odoo 19?

TICKETayuda@ganemo.com

Specifications

Version 19.0, 20.0