Files
pms/pms/tests/test_pms_amenity.py
Darío Lodeiros e7c0c3e5bd [ADD]multi_pms_properties (#66)
* [WIP]pms: models check_pms_property

* [WIP][IMP+REF] multi_pms_properties: refactor and added test skeleton

* [FIX] inherit create models

* [ADD] room multiproperty check

* [ADD] room multiproperty check

* [IMP] Multiproperty checks in pms models

* [IMP] Fix Multiproperty checks in pms models

* [IMP] Add multiproperty domain in multi_pms_properties module

* [IMP] Fix multiproperty checks in pms tests

* [IMP] Fix multiproperty checks logic

* [IMP] Auto Domains

* [IMP] availability property results, domain preferred_room_id

* [IMP] model domain properties

* [ADD] pms multiproperty depends

* [IMP] models and views multiproperty checks

* [FIX] Multiple rebase multiproperty fixes

* [ADD] Readme

* [ADD] Company - multiproperty checks

* [ADD] travis server wide modules multiproperty

* [FIX] travis conf load

* [FIX] travis conf load2

* [FIX] travis conf load2

Co-authored-by: Eric Antones <eantones@nuobit.com>
Co-authored-by: Sara Lago <saralago126@gmail.com>
2021-04-27 20:01:42 +02:00

72 lines
2.4 KiB
Python

from odoo.exceptions import UserError
from .common import TestPms
class TestPmsAmenity(TestPms):
def setUp(self):
super().setUp()
# Create two properties
# +-----------+-----------+
# | Properties |
# +-----------+-----------+
# | Property2 - Property3 |
# +-----------+-----------+
self.pms_property2 = self.env["pms.property"].create(
{
"name": "Pms_property_test2",
"company_id": self.company1.id,
"default_pricelist_id": self.pricelist1.id,
}
)
self.pms_property3 = self.env["pms.property"].create(
{
"name": "Pms_property_test3",
"company_id": self.company1.id,
"default_pricelist_id": self.pricelist1.id,
}
)
def test_property_not_allowed(self):
# Creation of a Amenity with Properties incompatible with it Amenity Type
# +-----------------------------------+-----------------------------------+
# | Amenity Type (TestAmenityType1) | Amenity (TestAmenity1) |
# +-----------------------------------+-----------------------------------+
# | Property1 - Property2 | Property1 - Property2 - Property3 |
# +-----------------------------------+-----------------------------------+
# ARRANGE
AmenityType = self.env["pms.amenity.type"]
Amenity = self.env["pms.amenity"]
amenity_type1 = AmenityType.create(
{
"name": "TestAmenityType1",
"pms_property_ids": [
(4, self.pms_property1.id),
(4, self.pms_property2.id),
],
}
)
# ACT & ASSERT
with self.assertRaises(UserError), self.cr.savepoint():
Amenity.create(
{
"name": "TestAmenity1",
"pms_amenity_type_id": amenity_type1.id,
"pms_property_ids": [
(
6,
0,
[
self.pms_property1.id,
self.pms_property2.id,
self.pms_property3.id,
],
)
],
}
)