mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] test case assign use room secuence to avoid ifs
This commit is contained in:
@@ -4,7 +4,7 @@ from freezegun import freeze_time
|
|||||||
|
|
||||||
from odoo import fields
|
from odoo import fields
|
||||||
from odoo.exceptions import UserError, ValidationError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
from odoo.tests import common, tagged
|
from odoo.tests import common
|
||||||
|
|
||||||
|
|
||||||
@freeze_time("2012-01-14")
|
@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"
|
res.to_assign, "Reservation with preferred_room_id set to to_assign = True"
|
||||||
)
|
)
|
||||||
|
|
||||||
@tagged("herefail")
|
|
||||||
def test_reservation_auto_assign_after_create(self):
|
def test_reservation_auto_assign_after_create(self):
|
||||||
"""
|
"""
|
||||||
When assigning a room manually to a reservation marked "to be assigned",
|
When assigning a room manually to a reservation marked "to be assigned",
|
||||||
@@ -849,6 +848,10 @@ class TestPmsReservations(common.SavepointCase):
|
|||||||
"""
|
"""
|
||||||
# ARRANGE
|
# ARRANGE
|
||||||
self.create_common_scenario()
|
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(
|
res = self.env["pms.reservation"].create(
|
||||||
{
|
{
|
||||||
"checkin": fields.date.today(),
|
"checkin": fields.date.today(),
|
||||||
@@ -860,13 +863,8 @@ class TestPmsReservations(common.SavepointCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# ACT
|
# ACT
|
||||||
# we need to force the change of room assigned automatically (which we do not know)
|
# res shoul be room1 in preferred_room_id (minor sequence)
|
||||||
if res.preferred_room_id.id == self.room1.id:
|
res.preferred_room_id = self.room2.id
|
||||||
res.preferred_room_id = self.room2.id
|
|
||||||
else:
|
|
||||||
res.preferred_room_id.id = self.room1.id
|
|
||||||
|
|
||||||
res.flush()
|
|
||||||
|
|
||||||
# ASSERT
|
# ASSERT
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
|
|||||||
Reference in New Issue
Block a user