mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] pms: fix reservation_type when created with no folio
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user