From 50c1027bb479d937342c0b53a67129a523277f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Tue, 17 Dec 2024 16:34:56 +0100 Subject: [PATCH] [FIX]pms_l10n_es: test onboard data required --- pms/models/pms_checkin_partner.py | 4 +- pms/tests/test_pms_reservation.py | 70 ++++++++++++++-------------- pms_l10n_es/tests/test_wizard_ine.py | 34 +++++++++----- 3 files changed, 58 insertions(+), 50 deletions(-) diff --git a/pms/models/pms_checkin_partner.py b/pms/models/pms_checkin_partner.py index 8395d205d2..eb5bef2300 100644 --- a/pms/models/pms_checkin_partner.py +++ b/pms/models/pms_checkin_partner.py @@ -837,9 +837,7 @@ def _get_depends_state_fields(self): def _checkin_mandatory_fields( self, residence_country=False, document_type=False, birthdate_date=False ): - mandatory_fields = [ - "firstname", - ] + mandatory_fields = [] return mandatory_fields @api.model diff --git a/pms/tests/test_pms_reservation.py b/pms/tests/test_pms_reservation.py index ed1a50f11a..8827a38ba8 100644 --- a/pms/tests/test_pms_reservation.py +++ b/pms/tests/test_pms_reservation.py @@ -99,7 +99,7 @@ def setUpClass(cls): ) cls.agency1 = cls.env["res.partner"].create( { - "name": "partner1", + "firstname": "partner1", "is_agency": True, "invoice_to_agency": "always", "default_commission": 15, @@ -1666,7 +1666,7 @@ def test_reservation_action_checkout(self): # ARRANGE host = self.env["res.partner"].create( { - "name": "Miguel", + "firstname": "Miguel", "mobile": "654667733", "email": "miguel@example.com", "birthdate_date": "1995-12-10", @@ -1679,7 +1679,7 @@ def test_reservation_action_checkout(self): "name": "30065089H", "valid_from": datetime.date.today(), "partner_id": host.id, - "document_country_id": self.env.ref("base.es").id, + "country_id": self.env.ref("base.es").id, } ) r1 = self.env["pms.reservation"].create( @@ -1822,7 +1822,7 @@ def test_partner_is_agency(self): ) agency = self.env["res.partner"].create( { - "name": "partner1", + "firstname": "partner1", "is_agency": True, "sale_channel_id": sale_channel1.id, "invoice_to_agency": "always", @@ -1868,7 +1868,7 @@ def test_agency_pricelist(self): ) agency = self.env["res.partner"].create( { - "name": "partner1", + "firstname": "partner1", "is_agency": True, "sale_channel_id": sale_channel1.id, "apply_pricelist": True, @@ -1925,7 +1925,7 @@ def test_compute_ready_for_checkin(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Miguel", + "firstname": "Miguel", "mobile": "654667733", "email": "miguel@example.com", "birthdate_date": "1995-12-10", @@ -1938,12 +1938,12 @@ def test_compute_ready_for_checkin(self): "name": "30065000H", "valid_from": datetime.date.today(), "partner_id": self.host1.id, - "document_country_id": self.env.ref("base.es").id, + "country_id": self.env.ref("base.es").id, } ) self.host2 = self.env["res.partner"].create( { - "name": "Brais", + "firstname": "Brais", "mobile": "654437733", "email": "brais@example.com", "birthdate_date": "1995-12-10", @@ -1956,7 +1956,7 @@ def test_compute_ready_for_checkin(self): "name": "30065089H", "valid_from": datetime.date.today(), "partner_id": self.host2.id, - "document_country_id": self.env.ref("base.es").id, + "country_id": self.env.ref("base.es").id, } ) self.reservation = self.env["pms.reservation"].create( @@ -2002,7 +2002,7 @@ def test_check_checkout_less_checkin(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) with self.assertRaises(UserError): @@ -2028,7 +2028,7 @@ def test_check_more_adults_than_beds(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) with self.assertRaises(ValidationError): @@ -2054,7 +2054,7 @@ def test_check_format_arrival_hour(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) with self.assertRaises(ValidationError): @@ -2078,7 +2078,7 @@ def test_check_format_departure_hour(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) with self.assertRaises(ValidationError): @@ -2111,7 +2111,7 @@ def test_check_property_integrity_room(self): ) self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) self.room_type_double.pms_property_ids = [ @@ -2141,7 +2141,7 @@ def test_shared_folio_true(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) self.reservation = self.env["pms.reservation"].create( @@ -2176,7 +2176,7 @@ def test_shared_folio_false(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) self.reservation = self.env["pms.reservation"].create( @@ -2206,7 +2206,7 @@ def test_reservation_action_cancel_fail(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) reservation = self.env["pms.reservation"].create( @@ -2253,7 +2253,7 @@ def test_cancelation_reason_noshow(self): ) self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) @@ -2308,7 +2308,7 @@ def test_cancelation_reason_intime(self): ) self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) @@ -2362,7 +2362,7 @@ def test_cancelation_reason_late(self): ) self.host1 = self.env["res.partner"].create( { - "name": "Host1", + "firstname": "Host1", } ) @@ -2393,14 +2393,14 @@ def test_compute_checkin_partner_count(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Miguel", + "firstname": "Miguel", "mobile": "654667733", "email": "miguel@example.com", } ) self.host2 = self.env["res.partner"].create( { - "name": "Brais", + "firstname": "Brais", "mobile": "654437733", "email": "brais@example.com", } @@ -2454,14 +2454,14 @@ def test_compute_checkin_partner_pending_count(self): """ self.host1 = self.env["res.partner"].create( { - "name": "Miguel", + "firstname": "Miguel", "mobile": "654667733", "email": "miguel@example.com", } ) self.host2 = self.env["res.partner"].create( { - "name": "Brais", + "firstname": "Brais", "mobile": "654437733", "email": "brais@example.com", } @@ -2516,7 +2516,7 @@ def test_reservation_action_checkout_fail(self): """ host = self.env["res.partner"].create( { - "name": "Miguel", + "firstname": "Miguel", "mobile": "654667733", "email": "miguel@example.com", } @@ -2590,7 +2590,7 @@ def test_partner_is_agency_not_invoice_to_agency(self): ) agency = self.env["res.partner"].create( { - "name": "partner1", + "firstname": "partner1", "is_agency": True, "sale_channel_id": sale_channel1.id, } @@ -3056,7 +3056,7 @@ def test_default_normal_reservation_type(self): # ARRANGE checkin = fields.date.today() checkout = fields.date.today() + datetime.timedelta(days=3) - self.partner1 = self.env["res.partner"].create({"name": "Ana"}) + self.partner1 = self.env["res.partner"].create({"firstname": "Ana"}) folio1 = self.env["pms.folio"].create( { "pms_property_id": self.pms_property1.id, @@ -3272,7 +3272,7 @@ def test_reservation_type_by_folio(self): 'staff'. """ # ARRANGE AND ACT - self.partner1 = self.env["res.partner"].create({"name": "Ana"}) + self.partner1 = self.env["res.partner"].create({"firstname": "Ana"}) folio1 = self.env["pms.folio"].create( { "pms_property_id": self.pms_property1.id, @@ -3382,7 +3382,7 @@ def test_auto_complete_partner_mobile(self): # ARRANGE partner = self.env["res.partner"].create( { - "name": "Enrique", + "firstname": "Enrique", "mobile": "654667733", "email": "enrique@example.com", } @@ -3433,7 +3433,7 @@ def test_auto_complete_partner_email(self): # ARRANGE partner = self.env["res.partner"].create( { - "name": "Simon", + "firstname": "Simon", "mobile": "654667733", "email": "simon@example.com", } @@ -3482,7 +3482,7 @@ def test_is_possible_customer_by_email(self): # ARRANGE partner = self.env["res.partner"].create( { - "name": "Courtney Campbell", + "firstname": "Courtney Campbell", "email": "courtney@example.com", } ) @@ -3520,7 +3520,7 @@ def test_is_possible_customer_by_mobile(self): # ARRANGE partner = self.env["res.partner"].create( { - "name": "Ledicia Sandoval", + "firstname": "Ledicia Sandoval", "mobile": "615369231", } ) @@ -3560,7 +3560,7 @@ def test_add_possible_customer(self): # ARRANGE partner = self.env["res.partner"].create( { - "name": "Serafín Rivas", + "firstname": "Serafín Rivas", "email": "serafin@example.com", "mobile": "60595595", } @@ -3610,14 +3610,14 @@ def test_not_add_several_possibles_customers(self): # ARRANGE partner1 = self.env["res.partner"].create( { - "name": "Serafín Rivas", + "firstname": "Serafín Rivas", "email": "serafin@example.com", "mobile": "60595595", } ) partner2 = self.env["res.partner"].create( { - "name": "Simon", + "firstname": "Simon", "mobile": "654667733", "email": "simon@example.com", } diff --git a/pms_l10n_es/tests/test_wizard_ine.py b/pms_l10n_es/tests/test_wizard_ine.py index df15c71c9f..420a9ecf0b 100644 --- a/pms_l10n_es/tests/test_wizard_ine.py +++ b/pms_l10n_es/tests/test_wizard_ine.py @@ -102,7 +102,7 @@ def ideal_scenario(self): # Create partner 1 (italy) self.partner_1 = self.env["res.partner"].create( { - "name": "partner1", + "firstname": "partner1", "country_id": self.country_italy.id, "nationality_id": self.country_italy.id, "residence_country_id": self.country_italy.id, @@ -116,13 +116,14 @@ def ideal_scenario(self): "name": "55103354T", "valid_from": datetime.date.today(), "partner_id": self.partner_1.id, + "country_id": self.country_italy.id, } ) # Create partner 2 (russia) self.partner_2 = self.env["res.partner"].create( { - "name": "partner2", + "firstname": "partner2", "country_id": self.country_russia.id, "nationality_id": self.country_russia.id, "residence_country_id": self.country_russia.id, @@ -136,12 +137,13 @@ def ideal_scenario(self): "name": "45437298Q", "valid_from": datetime.date.today(), "partner_id": self.partner_2.id, + "country_id": self.country_russia.id, } ) # Create partner 3 (italy) self.partner_3 = self.env["res.partner"].create( { - "name": "partner3", + "firstname": "partner3", "country_id": self.country_italy.id, "nationality_id": self.country_italy.id, "residence_country_id": self.country_italy.id, @@ -155,12 +157,13 @@ def ideal_scenario(self): "name": "81534086Y", "valid_from": datetime.date.today(), "partner_id": self.partner_3.id, + "country_id": self.country_italy.id, } ) # Create partner 4 (italy) self.partner_4 = self.env["res.partner"].create( { - "name": "partner4", + "firstname": "partner4", "country_id": self.country_italy.id, "nationality_id": self.country_italy.id, "residence_country_id": self.country_italy.id, @@ -174,12 +177,13 @@ def ideal_scenario(self): "name": "00807643K", "valid_from": datetime.date.today(), "partner_id": self.partner_4.id, + "country_id": self.country_italy.id, } ) # Create partner 5 (afghanistan) self.partner_5 = self.env["res.partner"].create( { - "name": "partner5", + "firstname": "partner5", "country_id": self.country_afghanistan.id, "nationality_id": self.country_afghanistan.id, "residence_country_id": self.country_afghanistan.id, @@ -193,12 +197,13 @@ def ideal_scenario(self): "name": "54564399G", "valid_from": datetime.date.today(), "partner_id": self.partner_5.id, + "country_id": self.country_afghanistan.id, } ) # Create partner 6 (afghanistan) self.partner_6 = self.env["res.partner"].create( { - "name": "partner6", + "firstname": "partner6", "country_id": self.country_afghanistan.id, "nationality_id": self.country_afghanistan.id, "residence_country_id": self.country_afghanistan.id, @@ -212,12 +217,13 @@ def ideal_scenario(self): "name": "39854152M", "valid_from": datetime.date.today(), "partner_id": self.partner_6.id, + "country_id": self.country_afghanistan.id, } ) # Create partner 7 (afghanistan) self.partner_7 = self.env["res.partner"].create( { - "name": "partner7", + "firstname": "partner7", "country_id": self.country_afghanistan.id, "nationality_id": self.country_afghanistan.id, "residence_country_id": self.country_afghanistan.id, @@ -231,6 +237,7 @@ def ideal_scenario(self): "name": "39854152O", "valid_from": datetime.date.today(), "partner_id": self.partner_7.id, + "country_id": self.country_afghanistan.id, } ) @@ -405,7 +412,7 @@ def pending_checkins_scenario(self): # Create 3 checkin partners from russia self.partner_russia_1 = self.env["res.partner"].create( { - "name": "partner1", + "firstname": "partner1", "country_id": self.country_russia.id, "nationality_id": self.country_russia.id, "residence_country_id": self.country_russia.id, @@ -418,7 +425,7 @@ def pending_checkins_scenario(self): ) self.partner_russia_2 = self.env["res.partner"].create( { - "name": "partner2", + "firstname": "partner2", "country_id": self.country_russia.id, "nationality_id": self.country_russia.id, "residence_country_id": self.country_russia.id, @@ -431,7 +438,7 @@ def pending_checkins_scenario(self): ) self.partner_russia_3 = self.env["res.partner"].create( { - "name": "partner3", + "firstname": "partner3", "country_id": self.country_russia.id, "nationality_id": self.country_russia.id, "residence_country_id": self.country_russia.id, @@ -449,22 +456,25 @@ def pending_checkins_scenario(self): "name": "15103354T", "valid_from": datetime.date.today(), "partner_id": self.partner_russia_1.id, + "country_id": self.country_russia.id, } ) self.env["res.partner.id_number"].create( { "category_id": self.id_category_passport.id, - "name": "25103354T", + "firstname": "25103354T", "valid_from": datetime.date.today(), "partner_id": self.partner_russia_2.id, + "country_id": self.country_russia.id, } ) self.env["res.partner.id_number"].create( { "category_id": self.id_category_passport.id, - "name": "35103354T", + "firstname": "35103354T", "valid_from": datetime.date.today(), "partner_id": self.partner_russia_3.id, + "country_id": self.country_russia.id, } )