mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms_l10n_es: allow checkin without document in children
This commit is contained in:
committed by
miguelpadin
parent
99f29113ab
commit
43a75e5546
@@ -1,5 +1,7 @@
|
||||
import logging
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
from ..wizards.traveller_report import CREATE_OPERATION_CODE
|
||||
@@ -65,7 +67,9 @@ class PmsCheckinPartner(models.Model):
|
||||
record.support_number = False
|
||||
|
||||
@api.model
|
||||
def _checkin_mandatory_fields(self, residence_country=False, document_type=False):
|
||||
def _checkin_mandatory_fields(
|
||||
self, residence_country=False, document_type=False, birthdate_date=False
|
||||
):
|
||||
mandatory_fields = super(PmsCheckinPartner, self)._checkin_mandatory_fields(
|
||||
residence_country, document_type
|
||||
)
|
||||
@@ -73,9 +77,6 @@ class PmsCheckinPartner(models.Model):
|
||||
[
|
||||
"birthdate_date",
|
||||
"gender",
|
||||
"document_number",
|
||||
"document_type",
|
||||
"document_expedition_date",
|
||||
"nationality_id",
|
||||
"residence_street",
|
||||
"residence_city",
|
||||
@@ -84,6 +85,18 @@ class PmsCheckinPartner(models.Model):
|
||||
]
|
||||
)
|
||||
|
||||
# Checkins with age greater than 14 must have an identity document
|
||||
if birthdate_date:
|
||||
if birthdate_date <= fields.Date.today() - relativedelta(years=14):
|
||||
mandatory_fields.extend(
|
||||
[
|
||||
"document_number",
|
||||
"document_type",
|
||||
"document_expedition_date",
|
||||
"document_country_id",
|
||||
]
|
||||
)
|
||||
|
||||
if residence_country and residence_country.code == CODE_SPAIN:
|
||||
mandatory_fields.extend(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user