From 3f42e2720e1fd63c4bf71b8c47ad4032df378cc7 Mon Sep 17 00:00:00 2001 From: Dario Lodeiros Date: Wed, 16 Jun 2021 11:54:18 +0200 Subject: [PATCH] [IMP] test case assign use room secuence to avoid ifs --- pms/tests/test_pms_reservation.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pms/tests/test_pms_reservation.py b/pms/tests/test_pms_reservation.py index ec46660b0..0d6f181aa 100644 --- a/pms/tests/test_pms_reservation.py +++ b/pms/tests/test_pms_reservation.py @@ -4,7 +4,7 @@ from freezegun import freeze_time from odoo import fields from odoo.exceptions import UserError, ValidationError -from odoo.tests import common, tagged +from odoo.tests import common @freeze_time("2012-01-14") @@ -837,7 +837,6 @@ class TestPmsReservations(common.SavepointCase): res.to_assign, "Reservation with preferred_room_id set to to_assign = True" ) - @tagged("herefail") def test_reservation_auto_assign_after_create(self): """ When assigning a room manually to a reservation marked "to be assigned", @@ -849,6 +848,10 @@ class TestPmsReservations(common.SavepointCase): """ # ARRANGE self.create_common_scenario() + # set the priority of the rooms to control the room chosen by auto assign + self.room1.sequence = 1 + self.room2.sequence = 2 + res = self.env["pms.reservation"].create( { "checkin": fields.date.today(), @@ -860,13 +863,8 @@ class TestPmsReservations(common.SavepointCase): ) # ACT - # we need to force the change of room assigned automatically (which we do not know) - if res.preferred_room_id.id == self.room1.id: - res.preferred_room_id = self.room2.id - else: - res.preferred_room_id.id = self.room1.id - - res.flush() + # res shoul be room1 in preferred_room_id (minor sequence) + res.preferred_room_id = self.room2.id # ASSERT self.assertFalse(