mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[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>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
from .common import TestPms
|
||||
|
||||
@@ -51,7 +51,7 @@ class TestPmsAmenity(TestPms):
|
||||
}
|
||||
)
|
||||
# ACT & ASSERT
|
||||
with self.assertRaises(ValidationError), self.cr.savepoint():
|
||||
with self.assertRaises(UserError), self.cr.savepoint():
|
||||
Amenity.create(
|
||||
{
|
||||
"name": "TestAmenity1",
|
||||
@@ -69,115 +69,3 @@ class TestPmsAmenity(TestPms):
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
def test_property_allowed(self):
|
||||
# Creation of a Amenity with Properties compatible with it Amenity Type
|
||||
# Check Properties of Amenity are in Properties of Amenity Type
|
||||
# +----------------------------------------+-----------------------------------+
|
||||
# | Amenity Type (TestAmenityType1) | Amenity (TestAmenity1) |
|
||||
# +----------------------------------------+-----------------------------------+
|
||||
# | Property1 - Property2 - Property3 | Property1 - Property2 - Property3 |
|
||||
# +----------------------------------------+-----------------------------------+
|
||||
|
||||
# ARRANGE
|
||||
AmenityType = self.env["pms.amenity.type"]
|
||||
Amenity = self.env["pms.amenity"]
|
||||
amenity_type1 = AmenityType.create(
|
||||
{
|
||||
"name": "TestAmenityType1",
|
||||
"pms_property_ids": [
|
||||
(
|
||||
6,
|
||||
0,
|
||||
[
|
||||
self.pms_property1.id,
|
||||
self.pms_property2.id,
|
||||
self.pms_property3.id,
|
||||
],
|
||||
)
|
||||
],
|
||||
}
|
||||
)
|
||||
# ACT
|
||||
amenity1 = 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,
|
||||
],
|
||||
)
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
# ASSERT
|
||||
self.assertEqual(
|
||||
amenity1.pms_property_ids.ids,
|
||||
amenity_type1.pms_property_ids.ids,
|
||||
"Properties not allowed in amenity type",
|
||||
)
|
||||
|
||||
def test_change_amenity_property(self):
|
||||
# Creation of a Amenity with Properties compatible with it Amenity Type
|
||||
# Delete a Property in Amenity Type, check Validation Error when do that
|
||||
# 1st scenario:
|
||||
# +----------------------------------------+-----------------------------------+
|
||||
# | Amenity Type (TestAmenityType1) | Amenity (TestAmenity1) |
|
||||
# +----------------------------------------+-----------------------------------+
|
||||
# | Property1 - Property2 - Property3 | Property1 - Property2 - Property3 |
|
||||
# +----------------------------------------+-----------------------------------+
|
||||
# 2nd scenario(Error):
|
||||
# +----------------------------------------+-----------------------------------+
|
||||
# | 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),
|
||||
(4, self.pms_property3.id),
|
||||
],
|
||||
}
|
||||
)
|
||||
# ACT
|
||||
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,
|
||||
],
|
||||
)
|
||||
],
|
||||
}
|
||||
)
|
||||
# ASSERT
|
||||
with self.assertRaises(ValidationError):
|
||||
amenity_type1.pms_property_ids = [
|
||||
(
|
||||
6,
|
||||
0,
|
||||
[self.pms_property1.id, self.pms_property2.id],
|
||||
)
|
||||
]
|
||||
amenity_type1.flush()
|
||||
|
||||
Reference in New Issue
Block a user