Skip to content
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
192 changes: 192 additions & 0 deletions website_sale_country_vat_label/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
==============================
Website Sale Country VAT Label
==============================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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%2Fwebsite-lightgray.png?logo=github
:target: https://github.com/OCA/website/tree/18.0/website_country_vat_label
:alt: OCA/website
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/website-18-0/website-18-0-website_country_vat_label
: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/website&target_branch=18.0
:alt: Try me on Runboat

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

This module extends the functionality of the e-commerce platform to
support country-specific tax identifiers and to allow users to see
localized labels for the VAT field during the checkout process.

By default, Odoo uses a generic "VAT" label in the billing and shipping
address forms, regardless of the customer's country. This module
overrides that behavior by dynamically checking if the selected country
has a custom VAT label defined in its backend configuration (such as
"RUT", "CPF", "NIF", or "EIN") and displays it directly to the customer
on the website.

This enhancement significantly improves the user experience during
registration and checkout, reducing confusion for international
customers and ensuring higher data accuracy for B2B transactions by
matching official local terminology.

**Table of contents**

.. contents::
:local:

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

Business Need
~~~~~~~~~~~~~

In many countries, the term "VAT" (Value Added Tax) is not commonly used
or recognized by local citizens and businesses. For instance, companies
and customers in Chile look for "RUT", in Brazil for "CPF/CNPJ", in
Spain for "NIF/CIF", and in the United States for "EIN".

When an international or localized e-commerce website forces users to
fill out a field labeled generically as "VAT", it creates friction and
confusion during the checkout process. Users are often unsure whether
they should enter their personal ID, corporate tax number, or if the
field even applies to them. This module resolves this issue by
automatically adapting the form terminology to match local expectations
based on the selected country, thereby reducing cart abandonment and
improving data quality at registration.

Approach
~~~~~~~~

This module extends the standard Odoo website address rendering
controller. It intercepts the dictionary of values sent to the frontend
address form template (``_prepare_address_form_values``) and dynamically
replaces the static 'VAT' string label. It fetches the ``vat_label``
field configured on the selected country's backend record
(``res.country``). If a specific label is defined for that country, it
is displayed; otherwise, it seamlessly falls back to the standard "VAT"
term.

Useful Information
~~~~~~~~~~~~~~~~~~

- **Dependencies:** This module directly extends ``website_sale`` (the
core Odoo eCommerce module) and relies on the base ``res.country``
model features.
- **Recommended Setups:**

- **Multi-website:** Highly recommended for businesses running
multiple localized websites targeting different regions or countries
from a single Odoo database.
- **B2B Portals:** Essential for companies with a heavy B2B focus
where accurate tax identification is mandatory for automated
invoicing.

- **Complementary Modules:** This module pairs perfectly with OCA
localization modules (such as ``l10n_br_website_sale`` or equivalent
local modules) that enforce specific tax validation rules, ensuring
that the field not only looks right but also validates correctly
according to local laws.

Usage
=====

To use this module, you need to:

1. **Configure the Country VAT Label (Backend):**

- Go to **Contacts** > **Configuration** > **Countries**.
- Search for and select the country you want to configure (e.g.,
*Brazil* or *Chile*).
- In the form view, locate the **VAT Label** field and enter the
local terminology (e.g., *CPF/CNPJ* or *RUT*).
- Click **Save**.

|Configure Country VAT Label in Backend|

2. **Check the Website Checkout/Address Form (Frontend):**

- Go to your **Website** shop.
- Add any product to the cart and proceed to the **Checkout**.
- On the **Billing/Shipping Address** form, select the country you
configured in step 1.
- You will notice that the standard generic **"VAT"** input field
label dynamically changes to match the localized label you defined
(e.g., *RUT* or *CPF/CNPJ*).

|Dynamic VAT Label during Checkout|

.. |Configure Country VAT Label in Backend| image:: https://raw.githubusercontent.com/OCA/website/18.0/website_country_vat_label/static/description/country_form.png
.. |Dynamic VAT Label during Checkout| image:: https://raw.githubusercontent.com/OCA/website/18.0/website_country_vat_label/static/description/website_checkout.png

Changelog
=========

18.0.1.0.0 (2026-06-04)

::


- [ADD] Initial version of the module that introduces dynamic, country-specific VAT labels on the website address forms during checkout.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/website/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/website/issues/new?body=module:%20website_country_vat_label%0Aversion:%2018.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
-------

* MTS

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

- Juan Arcos j.arcos@madetosoft.com

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-jarcosmts| image:: https://github.com/jarcosmts.png?size=40px
:target: https://github.com/jarcosmts
:alt: jarcosmts

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

|maintainer-jarcosmts|

This module is part of the `OCA/website <https://github.com/OCA/website/tree/18.0/website_country_vat_label>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions website_sale_country_vat_label/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import controllers
17 changes: 17 additions & 0 deletions website_sale_country_vat_label/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2026 MTS - Juan Arcos
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Website Sale Country VAT Label",
"summary": "Use country specific VAT label in website address form",
"version": "18.0.1.0.0",
"development_status": "Beta",
"category": "Website",
"website": "https://github.com/OCA/website",
"author": "MTS, Odoo Community Association (OCA)",
"maintainers": ["jarcosmts"],
"license": "AGPL-3",
"application": False,
"installable": True,
"preloadable": False,
"depends": ["website_sale"],
}
3 changes: 3 additions & 0 deletions website_sale_country_vat_label/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import main
23 changes: 23 additions & 0 deletions website_sale_country_vat_label/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2026 MTS - Juan Arcos
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.http import request

from odoo.addons.website_sale.controllers.main import WebsiteSale


class WebsiteSaleVatLabel(WebsiteSale):
def _prepare_address_form_values(self, *args, **kwargs):
"""Extend standard address values to support country-specific VAT labels.

This method overrides the generic 'VAT' label by checking if the
currently selected country has a custom label configured (e.g., RUT,
CPF). If found, it replaces the default label to improve localization.
"""
res = super()._prepare_address_form_values(*args, **kwargs)
country_sudo = res.get("country")

if country_sudo:
res["vat_label"] = country_sudo.vat_label or request.env._("VAT")

return res
3 changes: 3 additions & 0 deletions website_sale_country_vat_label/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
17 changes: 17 additions & 0 deletions website_sale_country_vat_label/readme/CONTEXT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Business Need

In many countries, the term "VAT" (Value Added Tax) is not commonly used or recognized by local citizens and businesses. For instance, companies and customers in Chile look for "RUT", in Brazil for "CPF/CNPJ", in Spain for "NIF/CIF", and in the United States for "EIN".

When an international or localized e-commerce website forces users to fill out a field labeled generically as "VAT", it creates friction and confusion during the checkout process. Users are often unsure whether they should enter their personal ID, corporate tax number, or if the field even applies to them. This module resolves this issue by automatically adapting the form terminology to match local expectations based on the selected country, thereby reducing cart abandonment and improving data quality at registration.

### Approach

This module extends the standard Odoo website address rendering controller. It intercepts the dictionary of values sent to the frontend address form template (`_prepare_address_form_values`) and dynamically replaces the static 'VAT' string label. It fetches the `vat_label` field configured on the selected country's backend record (`res.country`). If a specific label is defined for that country, it is displayed; otherwise, it seamlessly falls back to the standard "VAT" term.

### Useful Information

* **Dependencies:** This module directly extends `website_sale` (the core Odoo eCommerce module) and relies on the base `res.country` model features.
* **Recommended Setups:**
* **Multi-website:** Highly recommended for businesses running multiple localized websites targeting different regions or countries from a single Odoo database.
* **B2B Portals:** Essential for companies with a heavy B2B focus where accurate tax identification is mandatory for automated invoicing.
* **Complementary Modules:** This module pairs perfectly with OCA localization modules (such as `l10n_br_website_sale` or equivalent local modules) that enforce specific tax validation rules, ensuring that the field not only looks right but also validates correctly according to local laws.
1 change: 1 addition & 0 deletions website_sale_country_vat_label/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Juan Arcos <j.arcos@madetosoft.com>
5 changes: 5 additions & 0 deletions website_sale_country_vat_label/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module extends the functionality of the e-commerce platform to support country-specific tax identifiers and to allow users to see localized labels for the VAT field during the checkout process.

By default, Odoo uses a generic "VAT" label in the billing and shipping address forms, regardless of the customer's country. This module overrides that behavior by dynamically checking if the selected country has a custom VAT label defined in its backend configuration (such as "RUT", "CPF", "NIF", or "EIN") and displays it directly to the customer on the website.

This enhancement significantly improves the user experience during registration and checkout, reducing confusion for international customers and ensuring higher data accuracy for B2B transactions by matching official local terminology.
4 changes: 4 additions & 0 deletions website_sale_country_vat_label/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
18.0.1.0.0 (2026-06-04)
~~~~~~~~~~~~~~~~~~~~~~~

- [ADD] Initial version of the module that introduces dynamic, country-specific VAT labels on the website address forms during checkout.
17 changes: 17 additions & 0 deletions website_sale_country_vat_label/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
To use this module, you need to:

1. **Configure the Country VAT Label (Backend):**
* Go to **Contacts** > **Configuration** > **Countries**.
* Search for and select the country you want to configure (e.g., *Brazil* or *Chile*).
* In the form view, locate the **VAT Label** field and enter the local terminology (e.g., *CPF/CNPJ* or *RUT*).
* Click **Save**.

![Configure Country VAT Label in Backend](static/description/country_form.png)

2. **Check the Website Checkout/Address Form (Frontend):**
* Go to your **Website** shop.
* Add any product to the cart and proceed to the **Checkout**.
* On the **Billing/Shipping Address** form, select the country you configured in step 1.
* You will notice that the standard generic **"VAT"** input field label dynamically changes to match the localized label you defined (e.g., *RUT* or *CPF/CNPJ*).

![Dynamic VAT Label during Checkout](static/description/website_checkout.png)
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading