[FIX] pms: fix reservation_type when created with no folio

This commit is contained in:
miguelpadin
2021-07-27 15:18:49 +02:00
parent a68677f703
commit 86ed4554e0
2 changed files with 7 additions and 2 deletions

View File

@@ -342,7 +342,6 @@ class PmsReservation(models.Model):
reservation_type = fields.Selection(
string="Reservation Type",
help="Type of reservations. It can be 'normal', 'staff' or 'out of service",
default=lambda *a: "normal",
related="folio_id.reservation_type",
store=True,
readonly=False,
@@ -1636,6 +1635,12 @@ class PmsReservation(models.Model):
)
pms_property = self.env["pms.property"].browse(pms_property_id)
vals["name"] = pms_property.reservation_sequence_id._next_do()
if not vals.get("reservation_type"):
vals["reservation_type"] = (
folio.reservation_type if folio.reservation_type else "normal"
)
record = super(PmsReservation, self).create(vals)
if record.preconfirm:
record.confirm()

View File

@@ -569,7 +569,7 @@ class TestWizardINE(TestPms):
# ASSERT
self.assertDictEqual(nationalities, expected_result)
def _test_calculate_monthly_adr(self):
def test_calculate_monthly_adr(self):
"""
+-------------+-------+-------+-------+
| | 01 | 02 | 03 |