[FIX]pms: change unlink checkins partner autocreate by write

This commit is contained in:
Darío Lodeiros
2021-01-31 10:12:51 +01:00
parent c808170bc8
commit 6cd01fb0d2
2 changed files with 7 additions and 7 deletions

View File

@@ -208,7 +208,8 @@ class PmsCheckinPartner(models.Model):
lambda c: c.state == "draft"
)
if len(draft_checkins) > 0 and vals.get("partner_id"):
draft_checkins[0].sudo().unlink()
draft_checkins[0].write(vals)
return draft_checkins[0]
if vals.get("identifier", _("New")) == _("New") or "identifier" not in vals:
pms_property_id = (
self.env.user.get_active_property_ids()[0]

View File

@@ -348,7 +348,9 @@ class TestPmsCheckinPartner(TestHotel):
freezer.start()
PmsReservation.auto_no_show()
no_show_reservations = self.folio_1.filtered(lambda r: r.state == "no_show")
no_show_reservations = self.folio_1.reservation_ids.filtered(
lambda r: r.state == "no_show"
)
# ASSERT
self.assertEqual(
@@ -370,14 +372,11 @@ class TestPmsCheckinPartner(TestHotel):
freezer.start()
PmsReservation.auto_no_checkout()
no_checkout_reservations = self.folio_1.filtered(
lambda r: r.state == "no_checkout"
)
freezer.stop()
# ASSERT
self.assertEqual(
len(no_checkout_reservations),
1,
self.reservation_1.state,
"no_checkout",
"Reservations not set like No checkout",
)