[IMP]pms: checkin partner residence state

This commit is contained in:
Darío Lodeiros
2022-03-20 22:12:30 +01:00
parent a23a26fb8c
commit 2bd9ca2ff0
7 changed files with 12 additions and 92 deletions

View File

@@ -49,5 +49,5 @@ class PmsCheckinParnert(models.Model):
]
)
if depends or (country and country.code == CODE_SPAIN):
mandatory_fields.append("state_id")
mandatory_fields.append("residence_state_id")
return mandatory_fields

View File

@@ -16,7 +16,7 @@ class ResPartner(models.Model):
store=True,
)
@api.depends("nationality_id", "state_id")
@api.depends("nationality_id", "residence_state_id")
def _compute_ine_code(self):
for record in self:
if not record.nationality_id:
@@ -24,9 +24,9 @@ class ResPartner(models.Model):
elif record.nationality_id.code != CODE_SPAIN:
record.ine_code = record.nationality_id.code_alpha3
else:
if not record.state_id:
if not record.residence_state_id:
record.ine_code = False
record.ine_code = record.state_id.ine_code
record.ine_code = record.residence_state_id.ine_code
def _check_enought_invoice_data(self):
self.ensure_one()

View File

@@ -255,10 +255,10 @@ class WizardIne(models.TransientModel):
spanish_guests_with_no_state,
)
)
state_id = self.env["res.country.state"].browse(
residence_state_id = self.env["res.country.state"].browse(
entry_from_spain["residence_state_id"][0]
) # .ine_code
ine_code = state_id.ine_code
ine_code = residence_state_id.ine_code
# get count of each result
num_spain = entry_from_spain["__count"]