mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
100 lines
3.2 KiB
XML
100 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<odoo noupdate="1">
|
|
<record id="document_type_dni" model="res.partner.id_category">
|
|
<field name="name">DNI</field>
|
|
<field name="code">D</field>
|
|
<field name="country_ids" eval="[(6, 0, [ref('base.es')])]" />
|
|
<field name="priority">10</field>
|
|
<field name="validation_code">
|
|
letters = {
|
|
0: "T",
|
|
1: "R",
|
|
2: "W",
|
|
3: "A",
|
|
4: "G",
|
|
5: "M",
|
|
6: "Y",
|
|
7: "F",
|
|
8: "P",
|
|
9: "D",
|
|
10: "X",
|
|
11: "B",
|
|
12: "N",
|
|
13: "J",
|
|
14: "Z",
|
|
15: "S",
|
|
16: "Q",
|
|
17: "V",
|
|
18: "H",
|
|
19: "L",
|
|
20: "C",
|
|
21: "K",
|
|
22: "E",
|
|
}
|
|
dni_number = id_number.name[0:8]
|
|
dni_letter = id_number.name[
|
|
len(id_number.name) - 1 : len(id_number.name)
|
|
]
|
|
if dni_number.isdigit() and not dni_letter.isdigit():
|
|
if letters.get(int(dni_number) % 23) != dni_letter.upper():
|
|
failed = True
|
|
else:
|
|
failed = True
|
|
</field>
|
|
<!-- <field name="has_unique_numbers">True</field>-->
|
|
</record>
|
|
|
|
<record id="document_type_spanish_residence" model="res.partner.id_category">
|
|
<field name="name">Spanish Residence permit</field>
|
|
<field name="code">N</field>
|
|
<field name="priority">30</field>
|
|
<field name="country_ids" eval="[(6, 0, [ref('base.es')])]" />
|
|
<field name="validation_code">
|
|
permit_first_letter=id_number.name[0:1]
|
|
permit_last_letter = id_number.name[
|
|
len(id_number.name) - 1 : len(id_number.name)
|
|
]
|
|
if (permit_first_letter.upper() in ['X','Y']) and id_number.name[1:8].isdigit() and not permit_last_letter.isdigit():
|
|
failed = False
|
|
else:
|
|
failed = True
|
|
</field>
|
|
<!-- <field name="has_unique_numbers">True</field>-->
|
|
</record>
|
|
|
|
<!-- aeat document type mapped -->
|
|
<!-- disabled because this is an override of an existe record in this file -->
|
|
<!-- pylint: disable=redundant-modulename-xml -->
|
|
<!-- oca-hooks:disable=xml-redundant-module-name -->
|
|
<record id="pms_l10n_es.document_type_dni" model="res.partner.id_category">
|
|
<field name="aeat_identification_type">02</field>
|
|
</record>
|
|
<record
|
|
id="pms_l10n_es.document_type_spanish_residence"
|
|
model="res.partner.id_category"
|
|
>
|
|
<field name="aeat_identification_type">05</field>
|
|
</record>
|
|
<record
|
|
id="pms.document_type_european_residence"
|
|
model="res.partner.id_category"
|
|
>
|
|
<field name="aeat_identification_type">05</field>
|
|
</record>
|
|
<record id="pms.document_type_passport" model="res.partner.id_category">
|
|
<field name="aeat_identification_type">03</field>
|
|
</record>
|
|
<record id="pms.document_type_driving_license" model="res.partner.id_category">
|
|
<field name="aeat_identification_type">06</field>
|
|
</record>
|
|
<record
|
|
id="pms.document_type_identification_document"
|
|
model="res.partner.id_category"
|
|
>
|
|
<field name="aeat_identification_type">06</field>
|
|
</record>
|
|
<record id="base.es" model="res.country">
|
|
<field name="priority">10</field>
|
|
</record>
|
|
</odoo>
|