Multiproperty Constrains (#30)

* [IMP] add multiproperties demo data

* [IMP] add multiproperties checks in res_users

* [IMP] add test case in test_res_users

* [IMP] Add multiproperty checks in pms_amenity and pms_amenity_type

* [IMP] Add multiproperty in pms_board_service_room_type(pending review)

* [IMP] Add test case in test_pms_room_type_availability_rule to check multiproperties

* [IMP] Fixing test case in test_pms_room_type_availability_rule to check multiproperties

* [IMP] Add test case in test_pms_room_type_availability_rule

* [IMP] Removed field default_availability_plan_id from pms_property

* [IMP] Add multiproperty in pms_room_type_available_plan

* [IMP] pms: adding property in rooms_available

* [IMP] Add multiproperty in pms_room_type_availability_rule and product_pricelist(work in progress)

* [IMP] Add multiproperty in product_pricelist and product_pricelist_item

* [IMP] add multiproperties demo data

* [IMP] add multiproperties checks in res_users

* [IMP] add test case in test_res_users and pms_room_type_availability_rule

* [IMP] Add multiproperty checks in pms_amenity and pms_amenity_type

* [IMP] Add multiproperty in pms_board_service_room_type(pending review)

* [IMP] Removed field default_availability_plan_id from pms_property

* [IMP] Add multiproperty in pms_room_type_available_plan

* [IMP] pms: adding property in rooms_available

* [IMP] Add multiproperty in pms_room_type_availability_rule and product_pricelist(work in progress)

* [IMP] Add multiproperty in product_pricelist and product_pricelist_item

* [IMP] Pms: add compute_folio method in pms.service

* [IMP] Pms: add multiproperty integrity checks between room_type and its class

* [IMP] Pms: pms_property_id related to folio

* [IMP] Pms: add multiproperty integrity checks in pms_room with pms_room_type and pms_floor

* [IMP] Pms: adding multiproperty checks in room_type(work in progress)

* [IMP] Pms: Add property rules

* [FIX]pms: external ids security rules

* [FIX]pms: property checks

* [FIX]pms: get product on pricelist item multiproperty check

* [FIX]pms: delete test field default_plan

* [FIX]pms: property constrain to product from room type model

* [FIX]pms: ids references

* [IMP]pms: folio wizard price flow on odoo standar

Co-authored-by: Darío Lodeiros <dario@commitsun.com>
This commit is contained in:
Sara
2021-01-31 13:07:03 +01:00
committed by GitHub
parent 6cd01fb0d2
commit 57d3ab0c8a
34 changed files with 1298 additions and 241 deletions

View File

@@ -0,0 +1,98 @@
from odoo.exceptions import ValidationError
from .common import TestHotel
class TestPmsAmenity(TestHotel):
def create_common_scenario(self):
# create company and properties
self.company1 = self.env["res.company"].create(
{
"name": "Pms_Company_Test",
}
)
self.property1 = self.env["pms.property"].create(
{
"name": "Pms_property_test1",
"company_id": self.company1.id,
"default_pricelist_id": self.env.ref("product.list0").id,
}
)
self.property2 = self.env["pms.property"].create(
{
"name": "Pms_property_test2",
"company_id": self.company1.id,
"default_pricelist_id": self.env.ref("product.list0").id,
}
)
self.property3 = self.env["pms.property"].create(
{
"name": "Pms_property_test3",
"company_id": self.company1.id,
"default_pricelist_id": self.env.ref("product.list0").id,
}
)
def test_property_not_allowed(self):
# ARRANGE
name = "amenityTest1"
name2 = "amenity"
self.create_common_scenario()
AmenityType = self.env["pms.amenity.type"]
Amenity = self.env["pms.amenity"]
# ACT
A1 = AmenityType.create(
{
"name": name,
"pms_property_ids": [
(4, self.property1.id),
(4, self.property2.id),
],
}
)
# ASSERT
with self.assertRaises(ValidationError), self.cr.savepoint():
Amenity.create(
{
"name": name2,
"room_amenity_type_id": A1.id,
"pms_property_ids": [
(4, self.property1.id),
(4, self.property2.id),
(4, self.property3.id),
],
}
)
def test_check_allowed_property_ids(self):
# ARRANGE
name = "amenityTest1"
name2 = "amenity"
self.create_common_scenario()
AmenityType = self.env["pms.amenity.type"]
Amenity = self.env["pms.amenity"]
# ACT
AT1 = AmenityType.create(
{
"name": name,
"pms_property_ids": [
(4, self.property1.id),
(4, self.property2.id),
],
}
)
A2 = Amenity.create(
{
"name": name2,
"room_amenity_type_id": AT1.id,
"pms_property_ids": [
(4, self.property1.id),
(4, self.property2.id),
],
}
)
# ASSERT
self.assertEqual(
A2.allowed_property_ids, AT1.pms_property_ids, "Properties doesnt much"
)