| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Contacts (contacts)
• Discuss (mail) • Invoicing (account) |
| Lines of code | 151 |
| Technical Name |
document_type_validation |
| License | OPL-1 |
| Website | https://www.ganemo.co |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Contacts (contacts)
• Discuss (mail) • Invoicing (account) |
| Lines of code | 151 |
| Technical Name |
document_type_validation |
| License | OPL-1 |
| Website | https://www.ganemo.co |
Document Type Validation
Ensure VAT & ID Correctness
Prevent data entry errors by enforcing strict or flexible validation rules for DNI, RUC, Passport, and other ID types.
What We're Solving
----------------
Data Integrity
Avoid invalid identification numbers that cause issues with electronic invoicing and tax reporting. Validate lengths (exact or max) and types (numeric/alphanumeric) automatically.
Custom Regex Power
Need to validate a specific format like "ABC-123"? Use the new Validation Regex field to define your own rules without writing Python code. Perfect for foreign IDs.
Setup & User Manual
Comprehensive Guide
1. Configuration Guide
Define strict rules for each Document Type to ensure database integrity.
Key Fields Explanation:
- Length: The required number of characters (e.g., 8 for DNI).
- Exact Length: Choose 'Exact' (must equal Length) or 'Maximum' (must not exceed Length).
- Type: 'Numeric' (0-9 only), 'Alphanumeric' (Letters & Numbers), or 'Other' (No validation).
- Validation Regex: Advanced pattern matching. (Overrides standard 'Type' validation if set).
Step-by-Step Configuration:
- Go to Contacts > Configuration > Identification Types (or Accounting > Configuration).
- Select the Document Type you want to restrict (e.g., "RUC").
- Standard Setup:
- Set Length to
11. - Set Exact Length to
Exact. - Set Type to
Numeric. - Result: Users can only enter exactly 11 digits.
- Set Length to
- Advanced Setup (Foreign ID):
- Set Validation Regex to
^[A-Z]{2}-\d{6}$. - Result: Validates format like "US-123456". Usage of standard regex syntax is supported.
- Set Validation Regex to
2. Operating Manual (Workflow)
Understanding the User Experience and Validation Logic:
Real-Time Feedback
As soon as a user selects a Document Type or changes the VAT number, the system runs the validation.
If invalid, a Red Alert box appears instantly above the partner form, detailing exactly why it failed (e.g., "Contains letters but should be numeric").
Integrity Enforcement
The system creates a Blocking Constraint. It is technically impossible to save a Contact with an invalid ID number.
This prevents "dirty data" from entering your system via manual entry, mass imports, or API calls.
Hybrid Validation
The system automatically prioritizes your rules:
- If Regex is present -> Uses Regex.
- If Regex is empty -> Uses Type (Numeric/Alpha).
- Always checks Length (if defined).
Multi-National Support
You can define different rules for the same document type in different usage contexts or define generic "Passport" types with flexible 'Maximum' length rules to accommodate various countries.
QA / User Testing Scenarios
Enterprise Validation Plan
Scenario 1: Numeric Integrity
- Configuration: Set Document Type "DNI" to
Length: 8,Type: Numeric. - Action: Create a Partner, select "DNI", enter "12345ABC".
- Result: Visual Alert appears: "The identification number must contain only numbers." Save is blocked.
- Action: Correct to "12345678".
- Result: Alert disappears, Save allowed.
Scenario 2: Length Constraints (Exact vs Max)
Part A: Exact Length
- Config: Length=8, Exact_Length=Exact.
- Test: Input "12345" (5 digits). -> Fail (Too short).
- Test: Input "123456789" (9 digits). -> Fail (Too long).
Part B: Maximum Length
- Config: Length=12, Exact_Length=Maximum.
- Test: Input "123". -> Pass.
- Test: Input "1234567890123" (13 chars). -> Fail (Too long).
Scenario 3: Advanced Regex Validation
Goal: Validate complex License Plate format "ABC-123".
- Setup: In Regex field enter:
^[A-Z]{3}-\d{3}$ - Test: Enter "ABC-123". -> Success.
- Test: Enter "abc-123" (lowercase). -> Fail (Case sensitive).
- Test: Enter "123-ABC" (Wrong order). -> Fail.
- Test: Enter "ABC1234" (Missing hyphen). -> Fail.
Scenario 4: Bulk Import Protection
- Prepare a CSV file with 100 partners. Include 5 records with invalid DNI lengths (e.g., 7 digits).
- Go to Contacts > Favorites > Import Records.
- Attempt to import.
- Result: Odoo's import tool will flag the 5 invalid rows with "ValidationError: The identification number...".
- Conclusion: The database remains clean even during mass operations.
FAQ & Troubleshooting
Common Resolutions
I configured a Regex but it's not working. Why?
Reason: Regex syntax must be precise. Also,
Python's re.search is used.
Fix: Ensure
you are using ^ (start) and $ (end) anchors to match the whole
string. Example: use ^\d{8}$ instead of \d{8}. Test your regex
on regex101.com (Python flavor).
I can't save a Contact, it says "Must be Numeric".
Reason: The selected Document Type is configured as 'Numeric' but you entered a letter or space.
Fix: Check for hidden spaces at the start/end, or check if the Document Type configuration requires 'Alphanumeric' instead.
How do I handle Foreign Passports with varying lengths?
Scenario: Passports can clearly be any length up to 20 chars.
Fix:
Set Length to 20, Exact Length to
Maximum, and Type to Alphanumeric. This
allows flexibility while preventing excessively long garbage data.
Does this modify my existing data?
Answer: No.
Detail: Installing the module does NOT retroactively validate or block existing records. Validations run only when you Create a new record or Write/Edit an existing one.
Commercial & Sales
For inquiries about licenses, demos, or partnerships.
Official WhatsApp
Fastest response time.
LINK
+1 (828) 672-6150
Book a Demo
Let's explore your needs.
LINK
Technical Support
Existing customers regarding module functionality.
© 2026 Ganemo. All rights reserved. visit ganemo.com
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module