From 9ab43cfe4971a8a10e10c875fcc2bd75d1bd6ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Mon, 28 Nov 2022 11:31:03 +0100 Subject: [PATCH] [FIX]pms: add test data availability plan in pricelist --- pms/tests/common.py | 4 ++++ pms/tests/test_pms_availability_plan_rules.py | 1 + pms/tests/test_pms_multiproperty.py | 4 ++++ pms/tests/test_pms_pricelist.py | 3 +++ pms/tests/test_pms_reservation.py | 3 +++ pms/tests/test_pms_wizard_massive_changes.py | 1 + pms_l10n_es/tests/common.py | 6 ++++++ 7 files changed, 22 insertions(+) diff --git a/pms/tests/common.py b/pms/tests/common.py index e79743bb5..513ef000d 100644 --- a/pms/tests/common.py +++ b/pms/tests/common.py @@ -4,9 +4,13 @@ from odoo.tests import common class TestPms(common.SavepointCase): def setUp(self): super().setUp() + self.availability_plan1 = self.env["pms.availability.plan"].create( + {"name": "Availability Plan 1"} + ) self.pricelist1 = self.env["product.pricelist"].create( { "name": "Pricelist 1", + "availability_plan_id": self.availability_plan1.id, } ) self.company1 = self.env["res.company"].create( diff --git a/pms/tests/test_pms_availability_plan_rules.py b/pms/tests/test_pms_availability_plan_rules.py index 664dc66ca..ce3cfedd5 100644 --- a/pms/tests/test_pms_availability_plan_rules.py +++ b/pms/tests/test_pms_availability_plan_rules.py @@ -23,6 +23,7 @@ class TestPmsRoomTypeAvailabilityRules(TestPms): (4, self.pms_property1.id), (4, self.pms_property2.id), ], + "availability_plan_id": self.availability_plan1.id, } ) # pms.sale.channel diff --git a/pms/tests/test_pms_multiproperty.py b/pms/tests/test_pms_multiproperty.py index 6f74d82f7..34abf7249 100644 --- a/pms/tests/test_pms_multiproperty.py +++ b/pms/tests/test_pms_multiproperty.py @@ -41,6 +41,7 @@ class TestPmsMultiproperty(TestPms): (4, self.pms_property1.id), (4, self.pms_property2.id), ], + "availability_plan_id": self.availability_plan1.id, } ) self.availability_plan1 = self.env["pms.availability.plan"].create( @@ -200,6 +201,7 @@ class TestPmsMultiproperty(TestPms): (4, self.pms_property1.id), (4, self.pms_property2.id), ], + "availability_plan_id": self.availability_plan1.id, } ) # create new room_type @@ -732,6 +734,7 @@ class TestPmsMultiproperty(TestPms): (4, self.pms_property1.id), (4, self.pms_property2.id), ], + "availability_plan_id": self.availability_plan1.id, } ) self.room_type1 = self.env["pms.room.type"].create( @@ -872,6 +875,7 @@ class TestPmsMultiproperty(TestPms): (4, self.pms_property2.id), (4, self.pms_property3.id), ], + "availability_plan_id": self.availability_plan1.id, } ) diff --git a/pms/tests/test_pms_pricelist.py b/pms/tests/test_pms_pricelist.py index bebfd4ed4..380ef748b 100644 --- a/pms/tests/test_pms_pricelist.py +++ b/pms/tests/test_pms_pricelist.py @@ -53,6 +53,7 @@ class TestPmsPricelist(TestPms): { "name": "pricelist_2", "pms_property_ids": [self.pms_property1.id, self.pms_property2.id], + "availability_plan_id": self.availability_plan1.id, } ) # product.product 1 @@ -740,6 +741,7 @@ class TestPmsPricelist(TestPms): "pricelist_type": "daily", "pms_property_ids": tc["pms_property_ids"], "item_ids": [item.id], + "availability_plan_id": self.availability_plan1.id, } ) @@ -767,6 +769,7 @@ class TestPmsPricelist(TestPms): "pricelist_type": "daily", "pms_property_ids": [self.pms_property1.id], "item_ids": [item.id], + "availability_plan_id": self.availability_plan1.id, } ) self.assertTrue(self.pricelist_test, "Pricelist not created.") diff --git a/pms/tests/test_pms_reservation.py b/pms/tests/test_pms_reservation.py index 6f9348c50..5b9a93f8f 100644 --- a/pms/tests/test_pms_reservation.py +++ b/pms/tests/test_pms_reservation.py @@ -2260,6 +2260,7 @@ class TestPmsReservations(TestPms): "name": "Pricelist Test", "pms_property_ids": [self.pms_property1.id], "cancelation_rule_id": self.cancelation_rule.id, + "availability_plan_id": self.availability_plan1.id, } ) self.host1 = self.env["res.partner"].create( @@ -2314,6 +2315,7 @@ class TestPmsReservations(TestPms): "name": "Pricelist Test", "pms_property_ids": [self.pms_property1.id], "cancelation_rule_id": self.cancelation_rule.id, + "availability_plan_id": self.availability_plan1.id, } ) self.host1 = self.env["res.partner"].create( @@ -2366,6 +2368,7 @@ class TestPmsReservations(TestPms): "name": "Pricelist Test", "pms_property_ids": [self.pms_property1.id], "cancelation_rule_id": self.cancelation_rule.id, + "availability_plan_id": self.availability_plan1.id, } ) self.host1 = self.env["res.partner"].create( diff --git a/pms/tests/test_pms_wizard_massive_changes.py b/pms/tests/test_pms_wizard_massive_changes.py index 24b5dd077..8ff71e893 100644 --- a/pms/tests/test_pms_wizard_massive_changes.py +++ b/pms/tests/test_pms_wizard_massive_changes.py @@ -681,6 +681,7 @@ class TestPmsWizardMassiveChanges(TestPms): pricelist2 = self.env["product.pricelist"].create( { "name": "test pricelist 2", + "availability_plan_id": self.availability_plan1.id, } ) expected_pricelists = [self.pricelist1.id, pricelist2.id] diff --git a/pms_l10n_es/tests/common.py b/pms_l10n_es/tests/common.py index b106bd622..b40d30906 100644 --- a/pms_l10n_es/tests/common.py +++ b/pms_l10n_es/tests/common.py @@ -4,9 +4,15 @@ from odoo.tests import common class TestPms(common.SavepointCase): def setUp(self): super().setUp() + self.availability_plan1 = self.env["pms.availability.plan"].create( + { + "name": "Availability Plan 1", + } + ) self.pricelist1 = self.env["product.pricelist"].create( { "name": "Pricelist 1", + "availability_plan_id": self.availability_plan1.id, } ) self.company1 = self.env["res.company"].create(