mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: recovery nationality checkin information
This commit is contained in:
@@ -654,38 +654,38 @@ class TestWizardINE(TestPms):
|
||||
[("name", "=", "Pontevedra")]
|
||||
)
|
||||
|
||||
self.checkin1.residence_country_id = country_spain
|
||||
self.partner_1.residence_country_id = country_spain
|
||||
self.checkin1.nationality_id = country_spain
|
||||
self.partner_1.nationality_id = country_spain
|
||||
self.checkin1.residence_state_id = state_ourense
|
||||
self.partner_1.residence_state_id = state_ourense
|
||||
|
||||
self.checkin2.residence_country_id = country_spain
|
||||
self.partner_2.residence_country_id = country_spain
|
||||
self.checkin2.nationality_id = country_spain
|
||||
self.partner_2.nationality_id = country_spain
|
||||
self.checkin2.residence_state_id = state_pontevedra
|
||||
self.partner_2.residence_state_id = state_pontevedra
|
||||
|
||||
self.checkin3.residence_country_id = country_spain
|
||||
self.partner_3.residence_country_id = country_spain
|
||||
self.checkin3.nationality_id = country_spain
|
||||
self.partner_3.nationality_id = country_spain
|
||||
self.checkin3.residence_state_id = state_ourense
|
||||
self.partner_3.residence_state_id = state_ourense
|
||||
|
||||
self.checkin4.residence_country_id = country_spain
|
||||
self.partner_4.residence_country_id = country_spain
|
||||
self.checkin4.nationality_id = country_spain
|
||||
self.partner_4.nationality_id = country_spain
|
||||
self.checkin4.residence_state_id = state_ourense
|
||||
self.partner_4.residence_state_id = state_ourense
|
||||
|
||||
self.checkin5.residence_country_id = country_spain
|
||||
self.partner_5.residence_country_id = country_spain
|
||||
self.checkin5.nationality_id = country_spain
|
||||
self.partner_5.nationality_id = country_spain
|
||||
self.checkin5.residence_state_id = state_madrid
|
||||
self.partner_5.residence_state_id = state_madrid
|
||||
|
||||
self.checkin6.residence_country_id = country_spain
|
||||
self.partner_6.residence_country_id = country_spain
|
||||
self.checkin6.nationality_id = country_spain
|
||||
self.partner_6.nationality_id = country_spain
|
||||
self.checkin6.residence_state_id = state_madrid
|
||||
self.partner_6.residence_state_id = state_madrid
|
||||
|
||||
self.checkin7.residence_country_id = country_spain
|
||||
self.partner_7.residence_country_id = country_spain
|
||||
self.checkin7.nationality_id = country_spain
|
||||
self.partner_7.nationality_id = country_spain
|
||||
self.checkin7.residence_state_id = state_madrid
|
||||
self.partner_7.residence_state_id = state_madrid
|
||||
|
||||
@@ -898,7 +898,7 @@ class TestWizardINE(TestPms):
|
||||
"""
|
||||
# ARRANGE
|
||||
self.ideal_scenario()
|
||||
self.partner_2.residence_country_id = False
|
||||
self.partner_2.nationality_id = False
|
||||
start_date = datetime.date(2021, 2, 1)
|
||||
end_date = datetime.date(2021, 2, 4)
|
||||
|
||||
@@ -953,38 +953,38 @@ class TestWizardINE(TestPms):
|
||||
[("name", "=", "Ourense (Orense)")]
|
||||
)
|
||||
|
||||
self.checkin1.residence_country_id = country_spain
|
||||
self.partner_1.residence_country_id = country_spain
|
||||
self.checkin1.nationality_id = country_spain
|
||||
self.partner_1.nationality_id = country_spain
|
||||
self.checkin1.residence_state_id = state_ourense
|
||||
self.partner_1.residence_state_id = state_ourense
|
||||
|
||||
self.checkin2.residence_country_id = country_spain
|
||||
self.partner_2.residence_country_id = country_spain
|
||||
self.checkin2.nationality_id = country_spain
|
||||
self.partner_2.nationality_id = country_spain
|
||||
self.checkin2.residence_state_id = False
|
||||
self.partner_2.residence_state_id = False
|
||||
|
||||
self.checkin3.residence_country_id = country_spain
|
||||
self.partner_3.residence_country_id = country_spain
|
||||
self.checkin3.nationality_id = country_spain
|
||||
self.partner_3.nationality_id = country_spain
|
||||
self.checkin3.residence_state_id = state_ourense
|
||||
self.partner_3.residence_state_id = state_ourense
|
||||
|
||||
self.checkin4.residence_country_id = country_spain
|
||||
self.partner_4.residence_country_id = country_spain
|
||||
self.checkin4.nationality_id = country_spain
|
||||
self.partner_4.nationality_id = country_spain
|
||||
self.checkin4.residence_state_id = state_ourense
|
||||
self.partner_4.residence_state_id = state_ourense
|
||||
|
||||
self.checkin5.residence_country_id = country_spain
|
||||
self.partner_5.residence_country_id = country_spain
|
||||
self.checkin5.nationality_id = country_spain
|
||||
self.partner_5.nationality_id = country_spain
|
||||
self.checkin5.residence_state_id = state_madrid
|
||||
self.partner_5.residence_state_id = state_madrid
|
||||
|
||||
self.checkin6.residence_country_id = country_spain
|
||||
self.partner_6.residence_country_id = country_spain
|
||||
self.checkin6.nationality_id = country_spain
|
||||
self.partner_6.nationality_id = country_spain
|
||||
self.checkin6.residence_state_id = state_madrid
|
||||
self.partner_6.residence_state_id = state_madrid
|
||||
|
||||
self.checkin7.residence_country_id = country_spain
|
||||
self.partner_7.residence_country_id = country_spain
|
||||
self.checkin7.nationality_id = country_spain
|
||||
self.partner_7.nationality_id = country_spain
|
||||
self.checkin7.residence_state_id = state_madrid
|
||||
self.partner_7.residence_state_id = state_madrid
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ class TestWizardTravellerReport(TestPms):
|
||||
"reservation_id": self.reservation_1.id,
|
||||
"firstname": "John",
|
||||
"lastname": "Doe",
|
||||
"residence_country_id": self.country_italy.id,
|
||||
"nationality_id": self.country_italy.id,
|
||||
}
|
||||
)
|
||||
# Create reservation 2
|
||||
|
||||
@@ -130,7 +130,7 @@ class TravellerReport(models.TransientModel):
|
||||
else:
|
||||
content += "M|"
|
||||
content += line.birthdate_date.strftime("%Y%m%d") + "|"
|
||||
content += line.residence_country_id.name.upper() + "|"
|
||||
content += line.nationality_id.name.upper() + "|"
|
||||
content += line.arrival.strftime("%Y%m%d") + "\n"
|
||||
|
||||
return content
|
||||
|
||||
@@ -197,7 +197,7 @@ class WizardIne(models.TransientModel):
|
||||
"""
|
||||
|
||||
for entry in read_group_result:
|
||||
if not entry["residence_country_id"]:
|
||||
if not entry["nationality_id"]:
|
||||
guests_with_no_nationality = self.env["res.partner"].search(
|
||||
entry["__domain"]
|
||||
)
|
||||
@@ -212,10 +212,10 @@ class WizardIne(models.TransientModel):
|
||||
guests_with_no_nationality,
|
||||
)
|
||||
)
|
||||
# get residence_country_id from group set read_group results
|
||||
# get nationality_id from group set read_group results
|
||||
nationality_id_code = (
|
||||
self.env["res.country"]
|
||||
.search([("id", "=", entry["residence_country_id"][0])])
|
||||
.search([("id", "=", entry["nationality_id"][0])])
|
||||
.code
|
||||
)
|
||||
# all countries except Spain
|
||||
@@ -318,7 +318,7 @@ class WizardIne(models.TransientModel):
|
||||
if chk_part_same_reserv_with_checkin:
|
||||
# create partner with same country & state
|
||||
country_other = (
|
||||
chk_part_same_reserv_with_checkin.partner_id.residence_country_id.id
|
||||
chk_part_same_reserv_with_checkin.partner_id.nationality_id.id
|
||||
)
|
||||
state_other = (
|
||||
chk_part_same_reserv_with_checkin.partner_id.residence_state_id.id
|
||||
@@ -327,7 +327,7 @@ class WizardIne(models.TransientModel):
|
||||
{
|
||||
"name": "partner1",
|
||||
"country_id": country_other,
|
||||
"residence_country_id": country_other,
|
||||
"nationality_id": country_other,
|
||||
"residence_state_id": state_other,
|
||||
}
|
||||
)
|
||||
@@ -338,7 +338,7 @@ class WizardIne(models.TransientModel):
|
||||
{
|
||||
"name": "partner1",
|
||||
"country_id": country_spain.id,
|
||||
"residence_country_id": country_spain.id,
|
||||
"nationality_id": country_spain.id,
|
||||
"residence_state_id": state_madrid.id,
|
||||
}
|
||||
)
|
||||
@@ -351,12 +351,12 @@ class WizardIne(models.TransientModel):
|
||||
# arrivals
|
||||
arrivals = hosts.filtered(lambda x: x.checkin == p_date)
|
||||
|
||||
# arrivals grouped by residence_country_id
|
||||
# arrivals grouped by nationality_id
|
||||
read_by_arrivals = self.env["res.partner"].read_group(
|
||||
[("id", "in", arrivals.mapped("partner_id").ids)],
|
||||
["residence_country_id"],
|
||||
["residence_country_id"],
|
||||
orderby="residence_country_id",
|
||||
["nationality_id"],
|
||||
["nationality_id"],
|
||||
orderby="nationality_id",
|
||||
lazy=False,
|
||||
)
|
||||
|
||||
@@ -366,21 +366,21 @@ class WizardIne(models.TransientModel):
|
||||
# departures grouped by nationality_id
|
||||
read_by_departures = self.env["res.partner"].read_group(
|
||||
[("id", "in", departures.mapped("partner_id").ids)],
|
||||
["residence_country_id"],
|
||||
["residence_country_id"],
|
||||
orderby="residence_country_id",
|
||||
["nationality_id"],
|
||||
["nationality_id"],
|
||||
orderby="nationality_id",
|
||||
lazy=False,
|
||||
)
|
||||
|
||||
# pernoctations
|
||||
pernoctations = hosts - departures
|
||||
|
||||
# pernoctations grouped by residence_country_id
|
||||
# pernoctations grouped by nationality_id
|
||||
read_by_pernoctations = self.env["res.partner"].read_group(
|
||||
[("id", "in", pernoctations.mapped("partner_id").ids)],
|
||||
["residence_country_id"],
|
||||
["residence_country_id"],
|
||||
orderby="residence_country_id",
|
||||
["nationality_id"],
|
||||
["nationality_id"],
|
||||
orderby="nationality_id",
|
||||
lazy=False,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user