Merge PR #44 into 14.0

Signed-off-by DarioLodeiros
This commit is contained in:
OCA-git-bot
2021-07-16 14:53:31 +00:00
2 changed files with 15 additions and 11 deletions

View File

@@ -260,8 +260,8 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
+------------+------+------+------+----+----+----+
| room/date | 01 | 02 | 03 | 04 | 05 | 06 |
+------------+------+------+------+----+----+----+
| Double 101 | | r2 | r2 | | | |
| Double 102 | r2 | r1 | r1 | | | |
| Double 101 | r2 | r2 | r2 | | | |
| Double 102 | | r1 | r1 | | | |
+------------+------+------+------+----+----+----+
"""
# ARRANGE
@@ -298,7 +298,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
# ASSERT
self.assertTrue(
r1.reservation_line_ids.room_id == self.room2
and r2.reservation_line_ids[1:].room_id == self.room1
and r2.reservation_line_ids.room_id == self.room1
)
def test_swap_reservation_rooms_03(self):
@@ -364,6 +364,8 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
"""
Check that two rooms from two different reservations are swapped
correctly.
source: r1
target: r2
--------
Initial state
@@ -416,13 +418,15 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
# ASSERT
self.assertTrue(
r1.reservation_line_ids.room_id == self.room2
and r2.reservation_line_ids[:1].room_id == self.room1
and r2.reservation_line_ids.room_id == self.room1
)
def test_swap_reservation_rooms_05(self):
"""
Check that two rooms from two different reservations are swapped
correctly.
source: r2
target: r1
---------------
Initial state
@@ -542,8 +546,8 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
+------------+------+------+------+----+----+----+
| room/date | 01 | 02 | 03 | 04 | 05 | 06 |
+------------+------+------+------+----+----+----+
| Double 101 | r2 | | r2 | | | |
| Double 102 | r0 | r2 | r1 | | | |
| Double 101 | r2 | r2 | r2 | | | |
| Double 102 | r0 | | r1 | | | |
+------------+------+------+------+----+----+----+
"""
@@ -593,9 +597,7 @@ class TestPmsWizardSplitJoinSwapReservation(TestPms):
self.assertTrue(
r0.reservation_line_ids.room_id == self.room2
and r1.reservation_line_ids.room_id == self.room2
and r2.reservation_line_ids[0].room_id == self.room1
and r2.reservation_line_ids[2].room_id == self.room1
and r2.reservation_line_ids[1].room_id == self.room2
and r2.reservation_line_ids.room_id == self.room1
)
def test_swap_reservation_rooms_gap_02(self):

View File

@@ -52,7 +52,7 @@ class ReservationSplitJoinSwapWizard(models.TransientModel):
readonly=False,
store=True,
comodel_name="pms.reservation",
compute="_compute_reservations",
compute="_compute_reservation_ids",
)
room_source = fields.Many2one(
string="Room Source",
@@ -290,8 +290,10 @@ class ReservationSplitJoinSwapWizard(models.TransientModel):
line_room_target._compute_occupies_availability()
line_room_source._compute_occupies_availability()
else:
elif line_room_source:
line_room_source.room_id = target
elif line_room_target:
line_room_target.room_id = source
def action_split(self):
for record in self: