[14.0][FIX] pms: minor fixes (#51)

* [FIX] pms: constraint raised when there's no other room type with the same alternate key

* [FIX] pms: required default_pricelist_id field readded in property view

* [FIX] pms: pre-commit black error
This commit is contained in:
Eric Antones
2021-02-16 17:23:51 +01:00
committed by GitHub
parent 3eefc9a9ad
commit f3d4b7545b
3 changed files with 15 additions and 10 deletions

View File

@@ -144,10 +144,10 @@ class PmsRoomType(models.Model):
raise ValidationError(msg) raise ValidationError(msg)
else: else:
for pms_property in rec.pms_property_ids: for pms_property in rec.pms_property_ids:
if ( other = rec.get_unique_by_property_code(
rec.get_unique_by_property_code(pms_property.id, rec.code_type) pms_property.id, rec.code_type
!= rec )
): if other and other != rec:
raise ValidationError(msg) raise ValidationError(msg)
# ORM Overrides # ORM Overrides

View File

@@ -722,9 +722,7 @@ class TestPmsReservations(TestHotel):
# ACT # ACT
res.action_cancel() res.action_cancel()
# ASSERT # ASSERT
self.assertEqual(res.state, self.assertEqual(res.state, "cancelled", "The reservation should be cancelled")
'cancelled',
"The reservation should be cancelled")
@freeze_time("1981-11-01") @freeze_time("1981-11-01")
def test_reservation_action_checkout(self): def test_reservation_action_checkout(self):
@@ -761,6 +759,6 @@ class TestPmsReservations(TestHotel):
r1.action_reservation_checkout() r1.action_reservation_checkout()
# ASSERT # ASSERT
self.assertEqual(r1.state, self.assertEqual(
"done", r1.state, "done", "The reservation status should be done after checkout."
"The reservation status should be done after checkout.") )

View File

@@ -18,6 +18,13 @@
</group> </group>
</page> </page>
<page string="Settings" name="property_settings"> <page string="Settings" name="property_settings">
<group
colspan="4"
col="4"
string="Price and Availability Plans"
>
<field name="default_pricelist_id" required="True" />
</group>
<group string="Timezone"> <group string="Timezone">
<field name="tz" widget="timezone_mismatch" /> <field name="tz" widget="timezone_mismatch" />
</group> </group>