mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX]pms: change unlink checkins partner autocreate by write
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user