mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] pms: fix check adults w. extra beds, fix day_qty @ pms.service.line, change literal code spain & fix tests
This commit is contained in:
@@ -605,6 +605,29 @@ class PmsReservation(models.Model):
|
|||||||
readonly=False,
|
readonly=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
check_adults = fields.Boolean(
|
||||||
|
help="Internal field to force room capacity validations",
|
||||||
|
compute="_compute_check_adults",
|
||||||
|
readonly=False,
|
||||||
|
store=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _compute_date_order(self):
|
||||||
|
for record in self:
|
||||||
|
record.date_order = datetime.datetime.today()
|
||||||
|
|
||||||
|
@api.depends(
|
||||||
|
"service_ids",
|
||||||
|
"service_ids.service_line_ids",
|
||||||
|
"service_ids.service_line_ids.product_id",
|
||||||
|
"service_ids.service_line_ids.day_qty",
|
||||||
|
"reservation_line_ids",
|
||||||
|
"reservation_line_ids.room_id",
|
||||||
|
)
|
||||||
|
def _compute_check_adults(self):
|
||||||
|
for record in self:
|
||||||
|
record.check_adults = True
|
||||||
|
|
||||||
@api.depends(
|
@api.depends(
|
||||||
"checkin",
|
"checkin",
|
||||||
"checkout",
|
"checkout",
|
||||||
@@ -1423,23 +1446,6 @@ class PmsReservation(models.Model):
|
|||||||
# _("The room already is completed (%s)", record.name)
|
# _("The room already is completed (%s)", record.name)
|
||||||
# )
|
# )
|
||||||
|
|
||||||
@api.constrains("adults")
|
|
||||||
def _check_adults(self):
|
|
||||||
for record in self:
|
|
||||||
for line in record.reservation_line_ids:
|
|
||||||
extra_beds = record.service_ids.service_line_ids.filtered(
|
|
||||||
lambda x: x.date == line.date and x.product_id.is_extra_bed is True
|
|
||||||
)
|
|
||||||
if (
|
|
||||||
record.adults + record.children_occupying
|
|
||||||
) > line.room_id.get_capacity(len(extra_beds)):
|
|
||||||
raise ValidationError(
|
|
||||||
_(
|
|
||||||
"Persons can't be higher than room capacity (%s)",
|
|
||||||
record.name,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
@api.constrains("state")
|
@api.constrains("state")
|
||||||
def _check_onboard_reservation(self):
|
def _check_onboard_reservation(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
@@ -1484,6 +1490,13 @@ class PmsReservation(models.Model):
|
|||||||
if record.agency_id and not record.agency_id.is_agency:
|
if record.agency_id and not record.agency_id.is_agency:
|
||||||
raise ValidationError(_("booking agency with wrong configuration: "))
|
raise ValidationError(_("booking agency with wrong configuration: "))
|
||||||
|
|
||||||
|
@api.constrains("check_adults")
|
||||||
|
def _check_capacity(self):
|
||||||
|
for record in self:
|
||||||
|
self.env["pms.room"]._check_adults(
|
||||||
|
record, record.service_ids.service_line_ids
|
||||||
|
)
|
||||||
|
|
||||||
# Action methods
|
# Action methods
|
||||||
def open_partner(self):
|
def open_partner(self):
|
||||||
""" Utility method used to add an "View Customer" button in reservation views """
|
""" Utility method used to add an "View Customer" button in reservation views """
|
||||||
|
|||||||
@@ -470,17 +470,3 @@ class PmsReservationLine(models.Model):
|
|||||||
)
|
)
|
||||||
if duplicated:
|
if duplicated:
|
||||||
raise ValidationError(_("Duplicated reservation line date"))
|
raise ValidationError(_("Duplicated reservation line date"))
|
||||||
|
|
||||||
@api.constrains("room_id")
|
|
||||||
def _check_adults(self):
|
|
||||||
for record in self.filtered("room_id"):
|
|
||||||
extra_bed = record.reservation_id.service_ids.filtered(
|
|
||||||
lambda r: r.product_id.is_extra_bed is True
|
|
||||||
)
|
|
||||||
if (
|
|
||||||
record.reservation_id.adults + record.reservation_id.children_occupying
|
|
||||||
> record.room_id.get_capacity(len(extra_bed))
|
|
||||||
):
|
|
||||||
raise ValidationError(_("Persons can't be higher than room capacity"))
|
|
||||||
# if record.reservation_id.adults == 0:
|
|
||||||
# raise ValidationError(_("Reservation has no adults"))
|
|
||||||
|
|||||||
@@ -118,6 +118,26 @@ class PmsRoom(models.Model):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _check_adults(self, reservation, service_line_ids=False):
|
||||||
|
for line in reservation.reservation_line_ids:
|
||||||
|
num_extra_beds = 0
|
||||||
|
if service_line_ids:
|
||||||
|
extra_beds = service_line_ids.filtered(
|
||||||
|
lambda x: x.date == line.date and x.product_id.is_extra_bed is True
|
||||||
|
)
|
||||||
|
num_extra_beds = sum(extra_beds.mapped("day_qty")) if extra_beds else 0
|
||||||
|
if line.room_id:
|
||||||
|
if (
|
||||||
|
reservation.adults + reservation.children_occupying
|
||||||
|
) > line.room_id.get_capacity(num_extra_beds):
|
||||||
|
raise ValidationError(
|
||||||
|
_(
|
||||||
|
"Persons can't be higher than room capacity (%s)",
|
||||||
|
reservation.name,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# Business methods
|
# Business methods
|
||||||
|
|
||||||
def get_capacity(self, extra_bed=0):
|
def get_capacity(self, extra_bed=0):
|
||||||
|
|||||||
@@ -340,23 +340,24 @@ class PmsService(models.Model):
|
|||||||
move_day = 0
|
move_day = 0
|
||||||
if consumed_on == "after":
|
if consumed_on == "after":
|
||||||
move_day = 1
|
move_day = 1
|
||||||
service.service_line_ids -= (
|
for del_service_id in service.service_line_ids.filtered_domain(
|
||||||
service.service_line_ids.filtered_domain(
|
[
|
||||||
[
|
"|",
|
||||||
"|",
|
(
|
||||||
(
|
"date",
|
||||||
"date",
|
"<",
|
||||||
"<",
|
reservation.checkin + timedelta(move_day),
|
||||||
reservation.checkin + timedelta(move_day),
|
),
|
||||||
),
|
(
|
||||||
(
|
"date",
|
||||||
"date",
|
">=",
|
||||||
">=",
|
reservation.checkout + timedelta(move_day),
|
||||||
reservation.checkout + timedelta(move_day),
|
),
|
||||||
),
|
]
|
||||||
]
|
).ids:
|
||||||
)
|
lines.append((2, del_service_id))
|
||||||
)
|
# TODO: check intermediate states in check_adults restriction
|
||||||
|
# when lines are removed
|
||||||
service.service_line_ids = lines
|
service.service_line_ids = lines
|
||||||
else:
|
else:
|
||||||
if not service.service_line_ids:
|
if not service.service_line_ids:
|
||||||
@@ -535,10 +536,11 @@ class PmsService(models.Model):
|
|||||||
# Businness Methods
|
# Businness Methods
|
||||||
def _service_day_qty(self):
|
def _service_day_qty(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
qty = self.product_qty if len(self.service_line_ids) == 1 else 0
|
qty = self.product_qty if len(self.service_line_ids) == 1 else 1
|
||||||
if not self.reservation_id:
|
if not self.reservation_id:
|
||||||
return qty
|
return qty
|
||||||
# TODO: Pass per_person to service line from product default_per_person
|
# TODO: Pass per_person to service line from product default_per_person
|
||||||
|
# When the user modifies the quantity avoid overwriting
|
||||||
if self.product_id.per_person:
|
if self.product_id.per_person:
|
||||||
qty = self.reservation_id.adults
|
qty = self.reservation_id.adults
|
||||||
return qty
|
return qty
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class TestPmsReservations(TestPms):
|
|||||||
"name": "Double 101",
|
"name": "Double 101",
|
||||||
"room_type_id": self.room_type_double.id,
|
"room_type_id": self.room_type_double.id,
|
||||||
"capacity": 2,
|
"capacity": 2,
|
||||||
|
"extra_beds_allowed": 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -626,19 +627,20 @@ class TestPmsReservations(TestPms):
|
|||||||
# ACT & ASSERT
|
# ACT & ASSERT
|
||||||
with self.assertRaises(
|
with self.assertRaises(
|
||||||
ValidationError,
|
ValidationError,
|
||||||
msg="The number of people is lower than the capacity of the room",
|
msg="The number of people is greater than the capacity of the room",
|
||||||
):
|
):
|
||||||
self.env["pms.reservation"].create(
|
reservation = self.env["pms.reservation"].create(
|
||||||
{
|
{
|
||||||
"adults": 2,
|
"adults": 2,
|
||||||
"children_occupying": 1,
|
"children_occupying": 1,
|
||||||
"checkin": datetime.datetime.now(),
|
"checkin": datetime.datetime.now(),
|
||||||
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
|
"checkout": datetime.datetime.now() + datetime.timedelta(days=1),
|
||||||
"room_type_id": self.room_type_double.id,
|
"preferred_room_id": self.room1.id,
|
||||||
"partner_id": self.partner1.id,
|
"partner_id": self.partner1.id,
|
||||||
"pms_property_id": self.pms_property1.id,
|
"pms_property_id": self.pms_property1.id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
reservation.flush()
|
||||||
|
|
||||||
def test_to_assign_priority_reservation(self):
|
def test_to_assign_priority_reservation(self):
|
||||||
"""
|
"""
|
||||||
@@ -1930,16 +1932,17 @@ class TestPmsReservations(TestPms):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
with self.assertRaises(ValidationError):
|
with self.assertRaises(ValidationError):
|
||||||
self.env["pms.reservation"].create(
|
reservation = self.env["pms.reservation"].create(
|
||||||
{
|
{
|
||||||
"checkin": fields.date.today(),
|
"checkin": fields.date.today(),
|
||||||
"checkout": fields.date.today() + datetime.timedelta(days=3),
|
"checkout": fields.date.today() + datetime.timedelta(days=3),
|
||||||
"pms_property_id": self.pms_property1.id,
|
"pms_property_id": self.pms_property1.id,
|
||||||
"partner_id": self.host1.id,
|
"partner_id": self.host1.id,
|
||||||
"room_type_id": self.room_type_double.id,
|
"preferred_room_id": self.room1.id,
|
||||||
"adults": 4,
|
"adults": 4,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
reservation.flush()
|
||||||
|
|
||||||
def test_check_format_arrival_hour(self):
|
def test_check_format_arrival_hour(self):
|
||||||
"""
|
"""
|
||||||
@@ -2616,7 +2619,7 @@ class TestPmsReservations(TestPms):
|
|||||||
{
|
{
|
||||||
"checkin": fields.date.today() + datetime.timedelta(days=-3),
|
"checkin": fields.date.today() + datetime.timedelta(days=-3),
|
||||||
"checkout": fields.date.today() + datetime.timedelta(days=3),
|
"checkout": fields.date.today() + datetime.timedelta(days=3),
|
||||||
"room_type_id": self.room_type_double.id,
|
"preferred_room_id": self.room1.id,
|
||||||
"partner_id": self.partner1.id,
|
"partner_id": self.partner1.id,
|
||||||
"pms_property_id": self.pms_property1.id,
|
"pms_property_id": self.pms_property1.id,
|
||||||
"pricelist_id": self.pricelist1.id,
|
"pricelist_id": self.pricelist1.id,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<field name="tax_ids" invisible="1" />
|
<field name="tax_ids" invisible="1" />
|
||||||
<field name="checkin_partner_count" invisible="1" />
|
<field name="checkin_partner_count" invisible="1" />
|
||||||
<field name="to_assign" invisible="1" />
|
<field name="to_assign" invisible="1" />
|
||||||
|
<field name="check_adults" invisible="1" />
|
||||||
<button
|
<button
|
||||||
name="confirm"
|
name="confirm"
|
||||||
string="Confirm"
|
string="Confirm"
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class TestWizardINE(TestPms):
|
|||||||
{
|
{
|
||||||
"name": "partner1",
|
"name": "partner1",
|
||||||
"country_id": self.country_italy.id,
|
"country_id": self.country_italy.id,
|
||||||
|
"nationality_id": self.country_italy.id,
|
||||||
"birthdate_date": "2000-06-25",
|
"birthdate_date": "2000-06-25",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
}
|
}
|
||||||
@@ -90,6 +91,7 @@ class TestWizardINE(TestPms):
|
|||||||
{
|
{
|
||||||
"name": "partner2",
|
"name": "partner2",
|
||||||
"country_id": self.country_russia.id,
|
"country_id": self.country_russia.id,
|
||||||
|
"nationality_id": self.country_russia.id,
|
||||||
"birthdate_date": "2000-06-25",
|
"birthdate_date": "2000-06-25",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
}
|
}
|
||||||
@@ -107,6 +109,7 @@ class TestWizardINE(TestPms):
|
|||||||
{
|
{
|
||||||
"name": "partner3",
|
"name": "partner3",
|
||||||
"country_id": self.country_italy.id,
|
"country_id": self.country_italy.id,
|
||||||
|
"nationality_id": self.country_italy.id,
|
||||||
"birthdate_date": "2000-06-25",
|
"birthdate_date": "2000-06-25",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
}
|
}
|
||||||
@@ -124,6 +127,7 @@ class TestWizardINE(TestPms):
|
|||||||
{
|
{
|
||||||
"name": "partner4",
|
"name": "partner4",
|
||||||
"country_id": self.country_italy.id,
|
"country_id": self.country_italy.id,
|
||||||
|
"nationality_id": self.country_italy.id,
|
||||||
"birthdate_date": "2000-06-25",
|
"birthdate_date": "2000-06-25",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
}
|
}
|
||||||
@@ -141,6 +145,7 @@ class TestWizardINE(TestPms):
|
|||||||
{
|
{
|
||||||
"name": "partner5",
|
"name": "partner5",
|
||||||
"country_id": self.country_afghanistan.id,
|
"country_id": self.country_afghanistan.id,
|
||||||
|
"nationality_id": self.country_afghanistan.id,
|
||||||
"birthdate_date": "2000-06-25",
|
"birthdate_date": "2000-06-25",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
}
|
}
|
||||||
@@ -158,6 +163,7 @@ class TestWizardINE(TestPms):
|
|||||||
{
|
{
|
||||||
"name": "partner6",
|
"name": "partner6",
|
||||||
"country_id": self.country_afghanistan.id,
|
"country_id": self.country_afghanistan.id,
|
||||||
|
"nationality_id": self.country_afghanistan.id,
|
||||||
"birthdate_date": "2000-06-25",
|
"birthdate_date": "2000-06-25",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
}
|
}
|
||||||
@@ -175,6 +181,7 @@ class TestWizardINE(TestPms):
|
|||||||
{
|
{
|
||||||
"name": "partner7",
|
"name": "partner7",
|
||||||
"country_id": self.country_afghanistan.id,
|
"country_id": self.country_afghanistan.id,
|
||||||
|
"nationality_id": self.country_afghanistan.id,
|
||||||
"birthdate_date": "2000-06-25",
|
"birthdate_date": "2000-06-25",
|
||||||
"gender": "male",
|
"gender": "male",
|
||||||
}
|
}
|
||||||
@@ -257,15 +264,14 @@ class TestWizardINE(TestPms):
|
|||||||
{
|
{
|
||||||
"name": "Product test",
|
"name": "Product test",
|
||||||
"is_extra_bed": True,
|
"is_extra_bed": True,
|
||||||
|
"consumed_on": "before",
|
||||||
"per_day": True,
|
"per_day": True,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
service_extra_bed = self.env["pms.service"].create(
|
vals_service_extra_bed = {
|
||||||
{
|
"is_board_service": False,
|
||||||
"is_board_service": False,
|
"product_id": product_extra_bed.id,
|
||||||
"product_id": product_extra_bed.id,
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
# Create reservation 4
|
# Create reservation 4
|
||||||
self.reservation_4 = self.env["pms.reservation"].create(
|
self.reservation_4 = self.env["pms.reservation"].create(
|
||||||
{
|
{
|
||||||
@@ -275,7 +281,7 @@ class TestWizardINE(TestPms):
|
|||||||
"partner_id": self.partner_6.id,
|
"partner_id": self.partner_6.id,
|
||||||
"adults": 2,
|
"adults": 2,
|
||||||
"pms_property_id": self.pms_property1.id,
|
"pms_property_id": self.pms_property1.id,
|
||||||
"service_ids": [(6, 0, [service_extra_bed.id])],
|
"service_ids": [(0, 0, vals_service_extra_bed)],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.checkin6 = self.env["pms.checkin.partner"].create(
|
self.checkin6 = self.env["pms.checkin.partner"].create(
|
||||||
@@ -395,7 +401,7 @@ class TestWizardINE(TestPms):
|
|||||||
end_date = datetime.date(2021, 2, 4)
|
end_date = datetime.date(2021, 2, 4)
|
||||||
|
|
||||||
expected_result = {
|
expected_result = {
|
||||||
self.country_afghanistan.id: {
|
self.country_afghanistan.code: {
|
||||||
second_date: {
|
second_date: {
|
||||||
"arrivals": 3,
|
"arrivals": 3,
|
||||||
"pernoctations": 3,
|
"pernoctations": 3,
|
||||||
@@ -407,7 +413,7 @@ class TestWizardINE(TestPms):
|
|||||||
"departures": 3,
|
"departures": 3,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
self.country_italy.id: {
|
self.country_italy.code: {
|
||||||
start_date: {
|
start_date: {
|
||||||
"arrivals": 1,
|
"arrivals": 1,
|
||||||
"pernoctations": 1,
|
"pernoctations": 1,
|
||||||
@@ -421,7 +427,7 @@ class TestWizardINE(TestPms):
|
|||||||
"departures": 2,
|
"departures": 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
self.country_russia.id: {
|
self.country_russia.code: {
|
||||||
start_date: {
|
start_date: {
|
||||||
"arrivals": 1,
|
"arrivals": 1,
|
||||||
"pernoctations": 1,
|
"pernoctations": 1,
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import xml.etree.cElementTree as ET
|
|||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
CODE_SPAIN = 68
|
# TODO: Review code (code iso ?)
|
||||||
|
CODE_SPAIN = "ES"
|
||||||
|
|
||||||
|
|
||||||
class WizardIne(models.TransientModel):
|
class WizardIne(models.TransientModel):
|
||||||
@@ -197,21 +198,24 @@ class WizardIne(models.TransientModel):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
for entry in read_group_result:
|
for entry in read_group_result:
|
||||||
# get country_id from group set read_group results
|
# get nationality_id from group set read_group results
|
||||||
country_id_key = entry["country_id"][0]
|
nationality_id_code = (
|
||||||
|
self.env["res.country"]
|
||||||
|
.search([("id", "=", entry["nationality_id"][0])])
|
||||||
|
.code
|
||||||
|
)
|
||||||
# all countries except Spain
|
# all countries except Spain
|
||||||
if country_id_key != CODE_SPAIN:
|
if nationality_id_code != CODE_SPAIN:
|
||||||
|
|
||||||
# get count of each result
|
# get count of each result
|
||||||
num = entry["__count"]
|
num = entry["__count"]
|
||||||
|
|
||||||
# update/create dicts for countries & dates and set num. arrivals
|
# update/create dicts for countries & dates and set num. arrivals
|
||||||
if not nationalities.get(country_id_key):
|
if not nationalities.get(nationality_id_code):
|
||||||
nationalities[country_id_key] = dict()
|
nationalities[nationality_id_code] = dict()
|
||||||
if not nationalities[country_id_key].get(date):
|
if not nationalities[nationality_id_code].get(date):
|
||||||
nationalities[country_id_key][date] = dict()
|
nationalities[nationality_id_code][date] = dict()
|
||||||
nationalities[country_id_key][date][type_of_entry] = num
|
nationalities[nationality_id_code][date][type_of_entry] = num
|
||||||
else:
|
else:
|
||||||
# arrivals grouped by state_id (Spain "provincias")
|
# arrivals grouped by state_id (Spain "provincias")
|
||||||
read_by_arrivals_spain = self.env["res.partner"].read_group(
|
read_by_arrivals_spain = self.env["res.partner"].read_group(
|
||||||
@@ -270,33 +274,33 @@ class WizardIne(models.TransientModel):
|
|||||||
# arrivals
|
# arrivals
|
||||||
arrivals = hosts.filtered(lambda x: x.checkin == p_date)
|
arrivals = hosts.filtered(lambda x: x.checkin == p_date)
|
||||||
|
|
||||||
# arrivals grouped by country_id
|
# arrivals grouped by nationality_id
|
||||||
read_by_arrivals = self.env["res.partner"].read_group(
|
read_by_arrivals = self.env["res.partner"].read_group(
|
||||||
[("id", "in", arrivals.mapped("partner_id").ids)],
|
[("id", "in", arrivals.mapped("partner_id").ids)],
|
||||||
["country_id"],
|
["nationality_id"],
|
||||||
["country_id"],
|
["nationality_id"],
|
||||||
lazy=False,
|
lazy=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
# departures
|
# departures
|
||||||
departures = hosts.filtered(lambda x: x.checkout == p_date)
|
departures = hosts.filtered(lambda x: x.checkout == p_date)
|
||||||
|
|
||||||
# departures grouped by country_id
|
# departures grouped by nationality_id
|
||||||
read_by_departures = self.env["res.partner"].read_group(
|
read_by_departures = self.env["res.partner"].read_group(
|
||||||
[("id", "in", departures.mapped("partner_id").ids)],
|
[("id", "in", departures.mapped("partner_id").ids)],
|
||||||
["country_id"],
|
["nationality_id"],
|
||||||
["country_id"],
|
["nationality_id"],
|
||||||
lazy=False,
|
lazy=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
# pernoctations
|
# pernoctations
|
||||||
pernoctations = hosts - departures
|
pernoctations = hosts - departures
|
||||||
|
|
||||||
# pernoctations grouped by country_id
|
# pernoctations grouped by nationality_id
|
||||||
read_by_pernoctations = self.env["res.partner"].read_group(
|
read_by_pernoctations = self.env["res.partner"].read_group(
|
||||||
[("id", "in", pernoctations.mapped("partner_id").ids)],
|
[("id", "in", pernoctations.mapped("partner_id").ids)],
|
||||||
["country_id"],
|
["nationality_id"],
|
||||||
["country_id"],
|
["nationality_id"],
|
||||||
lazy=False,
|
lazy=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -457,7 +461,9 @@ class WizardIne(models.TransientModel):
|
|||||||
self.start_date, self.end_date, self.pms_property_id.id
|
self.start_date, self.end_date, self.pms_property_id.id
|
||||||
)
|
)
|
||||||
for key_country, value_country in nationalities.items():
|
for key_country, value_country in nationalities.items():
|
||||||
country = self.env["res.country"].browse(key_country)
|
|
||||||
|
country = self.env["res.country"].search([("code", "=", key_country)])
|
||||||
|
|
||||||
if key_country != CODE_SPAIN:
|
if key_country != CODE_SPAIN:
|
||||||
residency_tag = ET.SubElement(accommodation_tag, "RESIDENCIA")
|
residency_tag = ET.SubElement(accommodation_tag, "RESIDENCIA")
|
||||||
ET.SubElement(residency_tag, "ID_PAIS").text = country.code_alpha3
|
ET.SubElement(residency_tag, "ID_PAIS").text = country.code_alpha3
|
||||||
|
|||||||
Reference in New Issue
Block a user