Initial commit: L10N_Europe packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:52 +02:00
commit 9803722600
2377 changed files with 380711 additions and 0 deletions

View file

@ -0,0 +1,85 @@
# LATAM Localization Base
Add a new model named "Identification Type" that extend the vat field functionality in the partner and let the user to identify (an eventually invoice) to contacts not only with their fiscal tax ID (VAT) but with other types of identifications like national document, passport, foreign ID, etc. With this module installed you will see now in the partner form view two fields:
* Identification Type
* Identification Number
This behavior is a common requirement for some latam countries like Argentina and Chile. If your localization has this requirements then you need to depend on this module and define in your localization module the identifications types that are used in your country. Generally these types of identifications are defined by the government authorities that regulate the fiscal operations. For example:
* AFIP in Argentina defines DNI, CUIT (vat for legal entities), CUIL (vat for natural person), and another 80 valid identification types.
Each identification holds this information:
* name: short name of the identification
* description: could be the same short name or a long name
* country_id: the country where this identification belongs
* is_vat: identify this record as the corresponding VAT for the specific country.
* sequence: let us to sort the identification types depending on the ones that are most used.
* active: we can activate/inactivate identifications to make it easier to our customers
In order to make this module compatible for multi-company environments where we have companies that does not need/support this requirement, we have added generic identification types and generic rules to manage the contact information and make it transparent for the user when only use the VAT as we formerly know.
Generic Identifications:
* VAT: The Fiscal Tax Identification or VAT number, by default will be selected as identification type so the user will only need to add the related vat number.
* Passport
* Foreign ID (Foreign National Document)
Rules when creating a new partner: We will only see the identification types that are meaningful, taking into account these rules:
* If the partner have not country address set: Will show the generic identification types plus the ones defined in the partner's related company country (If the partner has not specific company then will show the identification types related to the current user company)
* If the partner has country address : will show the generic identification types plus the ones defined for the country of the partner.
When creating a new company, will set to the related partner always the related country is_vat identification type.
All the defined identification types can be reviewed and activate/deactivate in "Contacts / Configuration / Identification Type" menu.
This module is compatible with base_vat module in order to be able to validate VAT numbers for each country that have or not have the possibility to manage multiple identification types.
## Installation
```bash
pip install odoo-bringout-oca-ocb-l10n_latam_base
```
## Dependencies
This addon depends on:
- contacts
- base_vat
## Manifest Information
- **Name**: LATAM Localization Base
- **Version**: 1.0
- **Category**: Accounting/Localizations
- **License**: LGPL-3
- **Installable**: True
## Source
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `l10n_latam_base`.
## License
This package maintains the original LGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Reports: doc/REPORTS.md
- Security: doc/SECURITY.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View file

@ -0,0 +1,32 @@
# Architecture
```mermaid
flowchart TD
U[Users] -->|HTTP| V[Views and QWeb Templates]
V --> C[Controllers]
V --> W[Wizards Transient Models]
C --> M[Models and ORM]
W --> M
M --> R[Reports]
DX[Data XML] --> M
S[Security ACLs and Groups] -. enforces .-> M
subgraph L10n_latam_base Module - l10n_latam_base
direction LR
M:::layer
W:::layer
C:::layer
V:::layer
R:::layer
S:::layer
DX:::layer
end
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
```
Notes
- Views include tree/form/kanban templates and report templates.
- Controllers provide website/portal routes when present.
- Wizards are UI flows implemented with `models.TransientModel`.
- Data XML loads data/demo records; Security defines groups and access.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for l10n_latam_base. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,6 @@
# Dependencies
This addon depends on:
- [contacts](../../odoo-bringout-oca-ocb-contacts)
- [base_vat](../../odoo-bringout-oca-ocb-base_vat)

View file

@ -0,0 +1,4 @@
# FAQ
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
- Q: How to enable? A: Start server with --addon l10n_latam_base or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-ocb-l10n_latam_base"
# or
uv pip install odoo-bringout-oca-ocb-l10n_latam_base"
```

View file

@ -0,0 +1,14 @@
# Models
Detected core models and extensions in l10n_latam_base.
```mermaid
classDiagram
class l10n_latam_identification_type
class res_company
class res_partner
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: l10n_latam_base. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon l10n_latam_base
- License: LGPL-3

View file

@ -0,0 +1,3 @@
# Reports
This module does not define custom reports.

View file

@ -0,0 +1,34 @@
# Security
Access control and security definitions in l10n_latam_base.
## Access Control Lists (ACLs)
Model access permissions defined in:
- **[ir.model.access.csv](../l10n_latam_base/security/ir.model.access.csv)**
- 2 model access rules
## Record Rules
Row-level security rules defined in:
```mermaid
graph TB
subgraph "Security Layers"
A[Users] --> B[Groups]
B --> C[Access Control Lists]
C --> D[Models]
B --> E[Record Rules]
E --> F[Individual Records]
end
```
Security files overview:
- **[ir.model.access.csv](../l10n_latam_base/security/ir.model.access.csv)**
- Model access permissions (CRUD rights)
Notes
- Access Control Lists define which groups can access which models
- Record Rules provide row-level security (filter records by user/group)
- Security groups organize users and define permission sets
- All security is enforced at the ORM level by Odoo

View file

@ -0,0 +1,5 @@
# Troubleshooting
- Ensure Python and Odoo environment matches repo guidance.
- Check database connectivity and logs if startup fails.
- Validate that dependent addons listed in DEPENDENCIES.md are installed.

View file

@ -0,0 +1,7 @@
# Usage
Start Odoo including this addon (from repo root):
```bash
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon l10n_latam_base
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

@ -0,0 +1,14 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
from odoo import api, SUPERUSER_ID
def _set_default_identification_type(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
env.cr.execute(
"""
UPDATE res_partner
SET l10n_latam_identification_type_id = %s
""",
[env.ref('l10n_latam_base.it_vat').id]
)

View file

@ -0,0 +1,61 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'LATAM Localization Base',
'version': '1.0',
'category': 'Accounting/Localizations',
'sequence': 14,
'author': 'Odoo, ADHOC SA',
'summary': 'LATAM Identification Types',
'description': """
Add a new model named "Identification Type" that extend the vat field functionality in the partner and let the user to identify (an eventually invoice) to contacts not only with their fiscal tax ID (VAT) but with other types of identifications like national document, passport, foreign ID, etc. With this module installed you will see now in the partner form view two fields:
* Identification Type
* Identification Number
This behavior is a common requirement for some latam countries like Argentina and Chile. If your localization has this requirements then you need to depend on this module and define in your localization module the identifications types that are used in your country. Generally these types of identifications are defined by the government authorities that regulate the fiscal operations. For example:
* AFIP in Argentina defines DNI, CUIT (vat for legal entities), CUIL (vat for natural person), and another 80 valid identification types.
Each identification holds this information:
* name: short name of the identification
* description: could be the same short name or a long name
* country_id: the country where this identification belongs
* is_vat: identify this record as the corresponding VAT for the specific country.
* sequence: let us to sort the identification types depending on the ones that are most used.
* active: we can activate/inactivate identifications to make it easier to our customers
In order to make this module compatible for multi-company environments where we have companies that does not need/support this requirement, we have added generic identification types and generic rules to manage the contact information and make it transparent for the user when only use the VAT as we formerly know.
Generic Identifications:
* VAT: The Fiscal Tax Identification or VAT number, by default will be selected as identification type so the user will only need to add the related vat number.
* Passport
* Foreign ID (Foreign National Document)
Rules when creating a new partner: We will only see the identification types that are meaningful, taking into account these rules:
* If the partner have not country address set: Will show the generic identification types plus the ones defined in the partner's related company country (If the partner has not specific company then will show the identification types related to the current user company)
* If the partner has country address : will show the generic identification types plus the ones defined for the country of the partner.
When creating a new company, will set to the related partner always the related country is_vat identification type.
All the defined identification types can be reviewed and activate/deactivate in "Contacts / Configuration / Identification Type" menu.
This module is compatible with base_vat module in order to be able to validate VAT numbers for each country that have or not have the possibility to manage multiple identification types.
""",
'depends': [
'contacts',
'base_vat',
],
'data': [
'data/l10n_latam.identification.type.csv',
'views/res_partner_view.xml',
'views/l10n_latam_identification_type_view.xml',
'security/ir.model.access.csv',
],
'installable': True,
'post_init_hook': '_set_default_identification_type',
'license': 'LGPL-3',
}

View file

@ -0,0 +1,4 @@
id,name,sequence,is_vat
l10n_latam_base.it_vat,VAT,80,TRUE
l10n_latam_base.it_pass,Passport,90,
l10n_latam_base.it_fid,Foreign ID,100,
1 id name sequence is_vat
2 l10n_latam_base.it_vat VAT 80 TRUE
3 l10n_latam_base.it_pass Passport 90
4 l10n_latam_base.it_fid Foreign ID 100

View file

@ -0,0 +1,164 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_latam_base
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0alpha1+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-22 13:00+0000\n"
"PO-Revision-Date: 2019-08-22 13:00+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__active
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_l10n_latam_identification_type_search
msgid "Active"
msgstr "Activo"
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_l10n_latam_identification_type_search
msgid "Archived"
msgstr "Archivado"
#. module: l10n_latam_base
#: model:ir.model,name:l10n_latam_base.model_res_company
msgid "Companies"
msgstr "Compañías"
#. module: l10n_latam_base
#: model:ir.model,name:l10n_latam_base.model_res_partner
msgid "Contact"
msgstr "Contacto"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__country_id
msgid "Country"
msgstr "País"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__create_uid
msgid "Created by"
msgstr "Creado por"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__create_date
msgid "Created on"
msgstr "Creado el"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__description
msgid "Description"
msgstr "Descripción"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__display_name
msgid "Display Name"
msgstr "Nombre a mostrar"
#. module: l10n_latam_base
#: model:l10n_latam.identification.type,name:l10n_latam_base.it_fid
msgid "Foreign ID"
msgstr "Cédula Extranjera"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__id
msgid "ID"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_res_partner__vat
#: model:ir.model.fields,field_description:l10n_latam_base.field_res_users__vat
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_partner_latam_form
msgid "Identification Number"
msgstr "Número de Identificación"
#. module: l10n_latam_base
#: model:ir.model.fields,help:l10n_latam_base.field_res_partner__vat
#: model:ir.model.fields,help:l10n_latam_base.field_res_users__vat
msgid "Identification Number for selected type"
msgstr "Número de identificación para el tipo seleccionado"
#. module: l10n_latam_base
#: model:ir.actions.act_window,name:l10n_latam_base.action_l10n_latam_identification_type
#: model:ir.model.fields,field_description:l10n_latam_base.field_res_partner__l10n_latam_identification_type_id
#: model:ir.model.fields,field_description:l10n_latam_base.field_res_users__l10n_latam_identification_type_id
#: model:ir.ui.menu,name:l10n_latam_base.menu_l10n_latam_identification_type
msgid "Identification Type"
msgstr "Tipo de Identificación"
#. module: l10n_latam_base
#: model:ir.model,name:l10n_latam_base.model_l10n_latam_identification_type
msgid "Identification Types"
msgstr "Tipos de Identificación"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__is_vat
msgid "Is Vat"
msgstr "Es Identificación Fiscal?"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type____last_update
msgid "Last Modified on"
msgstr "Última modificación en"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__write_uid
msgid "Last Updated by"
msgstr "Última actualización por"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__write_date
msgid "Last Updated on"
msgstr "Última actualización el"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__name
msgid "Name"
msgstr "Nombre"
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_partner_latam_form
msgid "Number"
msgstr "Número"
#. module: l10n_latam_base
#: model:l10n_latam.identification.type,name:l10n_latam_base.it_pass
msgid "Passport"
msgstr "Pasaporte"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__sequence
msgid "Sequence"
msgstr "Secuencia"
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_l10n_latam_identification_type_search
msgid "Show active identification types"
msgstr "Mostrar los tipos de identificación activos"
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_l10n_latam_identification_type_search
msgid "Show archived identification types"
msgstr "Mostrar los tipos de identificación archivados"
#. module: l10n_latam_base
#: model:ir.model.fields,help:l10n_latam_base.field_res_partner__l10n_latam_identification_type_id
#: model:ir.model.fields,help:l10n_latam_base.field_res_users__l10n_latam_identification_type_id
msgid "The type of identification"
msgstr "Tipo de identificación"
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_partner_latam_form
msgid "Type"
msgstr "Tipo"
#. module: l10n_latam_base
#: model:l10n_latam.identification.type,name:l10n_latam_base.it_vat
msgid "VAT"
msgstr ""

View file

@ -0,0 +1,164 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_latam_base
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0alpha1+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-22 13:00+0000\n"
"PO-Revision-Date: 2019-08-22 13:00+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__active
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_l10n_latam_identification_type_search
msgid "Active"
msgstr ""
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_l10n_latam_identification_type_search
msgid "Archived"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model,name:l10n_latam_base.model_res_company
msgid "Companies"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model,name:l10n_latam_base.model_res_partner
msgid "Contact"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__country_id
msgid "Country"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__create_uid
msgid "Created by"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__create_date
msgid "Created on"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__description
msgid "Description"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__display_name
msgid "Display Name"
msgstr ""
#. module: l10n_latam_base
#: model:l10n_latam.identification.type,name:l10n_latam_base.it_fid
msgid "Foreign ID"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__id
msgid "ID"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_res_partner__vat
#: model:ir.model.fields,field_description:l10n_latam_base.field_res_users__vat
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_partner_latam_form
msgid "Identification Number"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,help:l10n_latam_base.field_res_partner__vat
#: model:ir.model.fields,help:l10n_latam_base.field_res_users__vat
msgid "Identification Number for selected type"
msgstr ""
#. module: l10n_latam_base
#: model:ir.actions.act_window,name:l10n_latam_base.action_l10n_latam_identification_type
#: model:ir.model.fields,field_description:l10n_latam_base.field_res_partner__l10n_latam_identification_type_id
#: model:ir.model.fields,field_description:l10n_latam_base.field_res_users__l10n_latam_identification_type_id
#: model:ir.ui.menu,name:l10n_latam_base.menu_l10n_latam_identification_type
msgid "Identification Type"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model,name:l10n_latam_base.model_l10n_latam_identification_type
msgid "Identification Types"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__is_vat
msgid "Is Vat"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type____last_update
msgid "Last Modified on"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__write_uid
msgid "Last Updated by"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__write_date
msgid "Last Updated on"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__name
msgid "Name"
msgstr ""
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_partner_latam_form
msgid "Number"
msgstr ""
#. module: l10n_latam_base
#: model:l10n_latam.identification.type,name:l10n_latam_base.it_pass
msgid "Passport"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,field_description:l10n_latam_base.field_l10n_latam_identification_type__sequence
msgid "Sequence"
msgstr ""
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_l10n_latam_identification_type_search
msgid "Show active identification types"
msgstr ""
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_l10n_latam_identification_type_search
msgid "Show archived identification types"
msgstr ""
#. module: l10n_latam_base
#: model:ir.model.fields,help:l10n_latam_base.field_res_partner__l10n_latam_identification_type_id
#: model:ir.model.fields,help:l10n_latam_base.field_res_users__l10n_latam_identification_type_id
msgid "The type of identification"
msgstr ""
#. module: l10n_latam_base
#: model_terms:ir.ui.view,arch_db:l10n_latam_base.view_partner_latam_form
msgid "Type"
msgstr ""
#. module: l10n_latam_base
#: model:l10n_latam.identification.type,name:l10n_latam_base.it_vat
msgid "VAT"
msgstr ""

View file

@ -0,0 +1,4 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import l10n_latam_identification_type
from . import res_partner
from . import res_company

View file

@ -0,0 +1,22 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
from odoo.osv import expression
class L10nLatamIdentificationType(models.Model):
_name = 'l10n_latam.identification.type'
_description = "Identification Types"
_order = 'sequence'
sequence = fields.Integer(default=10)
name = fields.Char(translate=True, required=True,)
description = fields.Char()
active = fields.Boolean(default=True)
is_vat = fields.Boolean()
country_id = fields.Many2one('res.country')
def name_get(self):
multi_localization = len(self.search([]).mapped('country_id')) > 1
return [(rec.id, '%s%s' % (
rec.name, multi_localization and rec.country_id and ' (%s)' % rec.country_id.code or '')) for rec in self]

View file

@ -0,0 +1,20 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
class ResCompany(models.Model):
_inherit = 'res.company'
@api.model_create_multi
def create(self, vals_list):
""" If exists, use specific vat identification.type for the country of the company """
companies = super().create(vals_list)
for company in companies:
if not company.country_id:
continue
country_vat_type = self.env['l10n_latam.identification.type'].search(
[('is_vat', '=', True), ('country_id', '=', company.country_id.id)], limit=1)
if country_vat_type:
company.partner_id.l10n_latam_identification_type_id = country_vat_type
return companies

View file

@ -0,0 +1,31 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
class ResPartner(models.Model):
_inherit = 'res.partner'
l10n_latam_identification_type_id = fields.Many2one('l10n_latam.identification.type',
string="Identification Type", index='btree_not_null', auto_join=True,
default=lambda self: self.env.ref('l10n_latam_base.it_vat', raise_if_not_found=False),
help="The type of identification")
vat = fields.Char(string='Identification Number', help="Identification Number for selected type")
@api.model
def _commercial_fields(self):
return super()._commercial_fields() + ['l10n_latam_identification_type_id']
@api.constrains('vat', 'l10n_latam_identification_type_id')
def check_vat(self):
with_vat = self.filtered(lambda x: x.l10n_latam_identification_type_id.is_vat)
return super(ResPartner, with_vat).check_vat()
@api.onchange('country_id')
def _onchange_country(self):
country = self.country_id or self.company_id.account_fiscal_country_id or self.env.company.account_fiscal_country_id
identification_type = self.l10n_latam_identification_type_id
if not identification_type or (identification_type.country_id != country):
self.l10n_latam_identification_type_id = self.env['l10n_latam.identification.type'].search(
[('country_id', '=', country.id), ('is_vat', '=', True)], limit=1) or self.env.ref(
'l10n_latam_base.it_vat', raise_if_not_found=False)

View file

@ -0,0 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_latam_identification_type_all","latam id type all","model_l10n_latam_identification_type",,1,0,0,0
"access_latam_identification_type_manager","latam id type manager","model_l10n_latam_identification_type","base.group_partner_manager",1,1,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_latam_identification_type_all latam id type all model_l10n_latam_identification_type 1 0 0 0
3 access_latam_identification_type_manager latam id type manager model_l10n_latam_identification_type base.group_partner_manager 1 1 0 0

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_l10n_latam_identification_type_tree" model="ir.ui.view">
<field name="name">l10n_latam.identification.type.tree</field>
<field name="model">l10n_latam.identification.type</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree decoration-muted="(not active)" create="0" edit="0">
<field name="name"/>
<field name="description"/>
<field name="country_id"/>
<field name="active" widget="boolean_toggle"/>
</tree>
</field>
</record>
<record id="view_l10n_latam_identification_type_search" model="ir.ui.view">
<field name="name">l10n_latam.identification.type.search</field>
<field name="model">l10n_latam.identification.type</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="description"/>
<field name="country_id"/>
<filter name="active" string="Active" domain="[('active','=',True)]" help="Show active identification types"/>
<filter name="inactive" string="Archived" domain="[('active','=',False)]" help="Show archived identification types"/>
</search>
</field>
</record>
<record id="action_l10n_latam_identification_type" model="ir.actions.act_window">
<field name="name">Identification Type</field>
<field name="res_model">l10n_latam.identification.type</field>
<field name="view_mode">tree</field>
<field name="search_view_id" ref="view_l10n_latam_identification_type_search"/>
<field name="domain">['|', ('active', '=', True), ('active', '=', False)]</field>
<field name="context">{"search_default_active":1}</field>
</record>
<menuitem action="action_l10n_latam_identification_type"
id="menu_l10n_latam_identification_type"
parent="contacts.res_partner_menu_config"/>
</odoo>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_partner_latam_form" model="ir.ui.view">
<field name="name">view_partner_latam_form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="model">res.partner</field>
<field name="priority">100</field>
<field type="xml" name="arch">
<field name="vat" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="vat" position="after">
<label for="l10n_latam_identification_type_id" string="Identification Number"/>
<div>
<field name="l10n_latam_identification_type_id" options="{'no_open': True, 'no_create': True}" placeholder="Type" attrs="{'readonly': [('parent_id','!=',False)]}" class="oe_inline" domain="country_id and ['|', ('country_id', '=', False), ('country_id', '=', country_id)] or []" required="True"/>
<span class="oe_read_only"> - </span>
<field name="vat" placeholder="Number" class="oe_inline" attrs="{'readonly': [('parent_id','!=',False)]}"/>
</div>
</field>
</field>
</record>
</odoo>

View file

@ -0,0 +1,43 @@
[project]
name = "odoo-bringout-oca-ocb-l10n_latam_base"
version = "16.0.0"
description = "LATAM Localization Base - LATAM Identification Types"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ocb-contacts>=16.0.0",
"odoo-bringout-oca-ocb-base_vat>=16.0.0",
"requests>=2.25.1"
]
readme = "README.md"
requires-python = ">= 3.11"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]
[project.urls]
homepage = "https://github.com/bringout/0"
repository = "https://github.com/bringout/0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["l10n_latam_base"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]