odoo-addon-pms 16.0.1.1.0__py3-none-any.whl → 16.0.2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/pms/README.rst +1 -1
- odoo/addons/pms/__manifest__.py +6 -5
- odoo/addons/pms/data/pms_data.xml +0 -11
- odoo/addons/pms/i18n/de.po +184 -315
- odoo/addons/pms/i18n/es.po +131 -308
- odoo/addons/pms/i18n/it.po +110 -310
- odoo/addons/pms/i18n/pms.pot +0 -176
- odoo/addons/pms/models/__init__.py +0 -2
- odoo/addons/pms/models/pms_checkin_partner.py +26 -322
- odoo/addons/pms/models/res_company.py +0 -6
- odoo/addons/pms/models/res_partner.py +0 -73
- odoo/addons/pms/static/description/index.html +1 -1
- odoo/addons/pms/tests/test_pms_checkin_partner.py +7 -445
- odoo/addons/pms/tests/test_pms_folio.py +0 -6
- odoo/addons/pms/tests/test_pms_reservation.py +7 -53
- odoo/addons/pms/tests/test_pms_reservation_line.py +0 -3
- odoo/addons/pms/views/pms_checkin_partner_views.xml +0 -21
- odoo/addons/pms/views/res_company_views.xml +0 -1
- odoo/addons/pms/views/res_partner_views.xml +0 -1
- {odoo_addon_pms-16.0.1.1.0.dist-info → odoo_addon_pms-16.0.2.1.0.dist-info}/METADATA +3 -3
- {odoo_addon_pms-16.0.1.1.0.dist-info → odoo_addon_pms-16.0.2.1.0.dist-info}/RECORD +23 -27
- odoo/addons/pms/models/res_partner_id_category.py +0 -14
- odoo/addons/pms/models/res_partner_id_number.py +0 -141
- odoo/addons/pms/views/res_partner_id_category_views.xml +0 -29
- odoo/addons/pms/views/res_partner_id_number_views.xml +0 -29
- {odoo_addon_pms-16.0.1.1.0.dist-info → odoo_addon_pms-16.0.2.1.0.dist-info}/WHEEL +0 -0
- {odoo_addon_pms-16.0.1.1.0.dist-info → odoo_addon_pms-16.0.2.1.0.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import logging
|
|
3
3
|
|
|
4
|
-
from dateutil.relativedelta import relativedelta
|
|
5
4
|
from freezegun import freeze_time
|
|
6
5
|
|
|
7
6
|
from odoo import fields
|
|
@@ -58,21 +57,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
58
57
|
"gender": "male",
|
|
59
58
|
}
|
|
60
59
|
)
|
|
61
|
-
cls.id_category = cls.env["res.partner.id_category"].search(
|
|
62
|
-
[("code", "=", "D")]
|
|
63
|
-
)
|
|
64
|
-
if not cls.id_category:
|
|
65
|
-
cls.id_category = cls.env["res.partner.id_category"].create(
|
|
66
|
-
{"name": "DNI", "code": "D"}
|
|
67
|
-
)
|
|
68
|
-
cls.env["res.partner.id_number"].create(
|
|
69
|
-
{
|
|
70
|
-
"category_id": cls.id_category.id,
|
|
71
|
-
"name": "30065089H",
|
|
72
|
-
"valid_from": today,
|
|
73
|
-
"partner_id": cls.host1.id,
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
60
|
cls.sale_channel_direct1 = cls.env["pms.sale.channel"].create(
|
|
77
61
|
{
|
|
78
62
|
"name": "Door",
|
|
@@ -125,14 +109,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
125
109
|
"gender": "male",
|
|
126
110
|
}
|
|
127
111
|
)
|
|
128
|
-
self.env["res.partner.id_number"].create(
|
|
129
|
-
{
|
|
130
|
-
"category_id": self.id_category.id,
|
|
131
|
-
"name": "85564627G",
|
|
132
|
-
"valid_from": datetime.date.today(),
|
|
133
|
-
"partner_id": host2.id,
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
112
|
self.reservation_1.checkin_partner_ids = [
|
|
137
113
|
(
|
|
138
114
|
0,
|
|
@@ -268,14 +244,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
268
244
|
"gender": "male",
|
|
269
245
|
}
|
|
270
246
|
)
|
|
271
|
-
self.env["res.partner.id_number"].create(
|
|
272
|
-
{
|
|
273
|
-
"category_id": self.id_category.id,
|
|
274
|
-
"name": "95876871Z",
|
|
275
|
-
"valid_from": datetime.date.today(),
|
|
276
|
-
"partner_id": host2.id,
|
|
277
|
-
}
|
|
278
|
-
)
|
|
279
247
|
host3 = self.env["res.partner"].create(
|
|
280
248
|
{
|
|
281
249
|
"name": "Enmanuel",
|
|
@@ -285,14 +253,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
285
253
|
"gender": "male",
|
|
286
254
|
}
|
|
287
255
|
)
|
|
288
|
-
self.env["res.partner.id_number"].create(
|
|
289
|
-
{
|
|
290
|
-
"category_id": self.id_category.id,
|
|
291
|
-
"name": "58261664L",
|
|
292
|
-
"valid_from": datetime.date.today(),
|
|
293
|
-
"partner_id": host3.id,
|
|
294
|
-
}
|
|
295
|
-
)
|
|
296
256
|
host4 = self.env["res.partner"].create(
|
|
297
257
|
{
|
|
298
258
|
"name": "Enrique",
|
|
@@ -302,14 +262,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
302
262
|
"gender": "male",
|
|
303
263
|
}
|
|
304
264
|
)
|
|
305
|
-
self.env["res.partner.id_number"].create(
|
|
306
|
-
{
|
|
307
|
-
"category_id": self.id_category.id,
|
|
308
|
-
"name": "61645604S",
|
|
309
|
-
"valid_from": datetime.date.today(),
|
|
310
|
-
"partner_id": host4.id,
|
|
311
|
-
}
|
|
312
|
-
)
|
|
313
265
|
self.env["pms.checkin.partner"].create(
|
|
314
266
|
{
|
|
315
267
|
"partner_id": host2.id,
|
|
@@ -358,14 +310,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
358
310
|
"gender": "male",
|
|
359
311
|
}
|
|
360
312
|
)
|
|
361
|
-
self.env["res.partner.id_number"].create(
|
|
362
|
-
{
|
|
363
|
-
"category_id": self.id_category.id,
|
|
364
|
-
"name": "63073204M",
|
|
365
|
-
"valid_from": datetime.date.today(),
|
|
366
|
-
"partner_id": self.host2.id,
|
|
367
|
-
}
|
|
368
|
-
)
|
|
369
313
|
self.host3 = self.env["res.partner"].create(
|
|
370
314
|
{
|
|
371
315
|
"name": "Enmanuel",
|
|
@@ -375,14 +319,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
375
319
|
"gender": "male",
|
|
376
320
|
}
|
|
377
321
|
)
|
|
378
|
-
self.env["res.partner.id_number"].create(
|
|
379
|
-
{
|
|
380
|
-
"category_id": self.id_category.id,
|
|
381
|
-
"name": "70699468K",
|
|
382
|
-
"valid_from": datetime.date.today(),
|
|
383
|
-
"partner_id": self.host3.id,
|
|
384
|
-
}
|
|
385
|
-
)
|
|
386
322
|
|
|
387
323
|
self.checkin2 = self.env["pms.checkin.partner"].create(
|
|
388
324
|
{
|
|
@@ -433,14 +369,7 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
433
369
|
"gender": "male",
|
|
434
370
|
}
|
|
435
371
|
)
|
|
436
|
-
|
|
437
|
-
{
|
|
438
|
-
"category_id": self.id_category.id,
|
|
439
|
-
"name": "12650631X",
|
|
440
|
-
"valid_from": datetime.date.today(),
|
|
441
|
-
"partner_id": self.host2.id,
|
|
442
|
-
}
|
|
443
|
-
)
|
|
372
|
+
|
|
444
373
|
# ACT
|
|
445
374
|
|
|
446
375
|
self.checkin2 = self.env["pms.checkin.partner"].create(
|
|
@@ -486,14 +415,7 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
486
415
|
"gender": "male",
|
|
487
416
|
}
|
|
488
417
|
)
|
|
489
|
-
|
|
490
|
-
{
|
|
491
|
-
"category_id": self.id_category.id,
|
|
492
|
-
"name": "61369791H",
|
|
493
|
-
"valid_from": datetime.date.today(),
|
|
494
|
-
"partner_id": self.host2.id,
|
|
495
|
-
}
|
|
496
|
-
)
|
|
418
|
+
|
|
497
419
|
self.host3 = self.env["res.partner"].create(
|
|
498
420
|
{
|
|
499
421
|
"name": "Enmanuel",
|
|
@@ -503,14 +425,7 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
503
425
|
"gender": "male",
|
|
504
426
|
}
|
|
505
427
|
)
|
|
506
|
-
|
|
507
|
-
{
|
|
508
|
-
"category_id": self.id_category.id,
|
|
509
|
-
"name": "53563260D",
|
|
510
|
-
"valid_from": datetime.date.today(),
|
|
511
|
-
"partner_id": self.host3.id,
|
|
512
|
-
}
|
|
513
|
-
)
|
|
428
|
+
|
|
514
429
|
self.host4 = self.env["res.partner"].create(
|
|
515
430
|
{
|
|
516
431
|
"name": "Enrique",
|
|
@@ -520,14 +435,7 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
520
435
|
"gender": "male",
|
|
521
436
|
}
|
|
522
437
|
)
|
|
523
|
-
|
|
524
|
-
{
|
|
525
|
-
"category_id": self.id_category.id,
|
|
526
|
-
"name": "63742138F",
|
|
527
|
-
"valid_from": datetime.date.today(),
|
|
528
|
-
"partner_id": self.host4.id,
|
|
529
|
-
}
|
|
530
|
-
)
|
|
438
|
+
|
|
531
439
|
self.reservation_1.write(
|
|
532
440
|
{
|
|
533
441
|
"checkin": datetime.date.today() + datetime.timedelta(days=1),
|
|
@@ -600,14 +508,7 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
600
508
|
"gender": "male",
|
|
601
509
|
}
|
|
602
510
|
)
|
|
603
|
-
|
|
604
|
-
{
|
|
605
|
-
"category_id": self.id_category.id,
|
|
606
|
-
"name": "61369791H",
|
|
607
|
-
"valid_from": datetime.date.today(),
|
|
608
|
-
"partner_id": self.host2.id,
|
|
609
|
-
}
|
|
610
|
-
)
|
|
511
|
+
|
|
611
512
|
self.host3 = self.env["res.partner"].create(
|
|
612
513
|
{
|
|
613
514
|
"name": "Enmanuel",
|
|
@@ -617,14 +518,7 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
617
518
|
"gender": "male",
|
|
618
519
|
}
|
|
619
520
|
)
|
|
620
|
-
|
|
621
|
-
{
|
|
622
|
-
"category_id": self.id_category.id,
|
|
623
|
-
"name": "53563260D",
|
|
624
|
-
"valid_from": datetime.date.today(),
|
|
625
|
-
"partner_id": self.host3.id,
|
|
626
|
-
}
|
|
627
|
-
)
|
|
521
|
+
|
|
628
522
|
self.host4 = self.env["res.partner"].create(
|
|
629
523
|
{
|
|
630
524
|
"name": "Enrique",
|
|
@@ -634,14 +528,7 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
634
528
|
"gender": "male",
|
|
635
529
|
}
|
|
636
530
|
)
|
|
637
|
-
|
|
638
|
-
{
|
|
639
|
-
"category_id": self.id_category.id,
|
|
640
|
-
"name": "63742138F",
|
|
641
|
-
"valid_from": datetime.date.today(),
|
|
642
|
-
"partner_id": self.host4.id,
|
|
643
|
-
}
|
|
644
|
-
)
|
|
531
|
+
|
|
645
532
|
self.reservation_1.write(
|
|
646
533
|
{
|
|
647
534
|
"checkin": datetime.date.today(),
|
|
@@ -926,8 +813,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
926
813
|
{
|
|
927
814
|
"firstname": "Pepe",
|
|
928
815
|
"lastname": "Paz",
|
|
929
|
-
"document_type": self.id_category.id,
|
|
930
|
-
"document_number": "77156490T",
|
|
931
816
|
"reservation_id": self.reservation_1.id,
|
|
932
817
|
}
|
|
933
818
|
)
|
|
@@ -938,28 +823,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
938
823
|
"Partner should have been created and associated with the checkin",
|
|
939
824
|
)
|
|
940
825
|
|
|
941
|
-
def test_not_create_partner_checkin_hasnt_enought_data(self):
|
|
942
|
-
"""
|
|
943
|
-
Check that partner is not created when the necessary minimum data isn't entered
|
|
944
|
-
into checkin_partner data, in this case document_id and document_number
|
|
945
|
-
"""
|
|
946
|
-
# ACT & ASSERT
|
|
947
|
-
checkin = self.env["pms.checkin.partner"].create(
|
|
948
|
-
{
|
|
949
|
-
"firstname": "Pepe",
|
|
950
|
-
"lastname": "Paz",
|
|
951
|
-
"email": "pepepaz@gmail.com",
|
|
952
|
-
"mobile": "666777777",
|
|
953
|
-
"reservation_id": self.reservation_1.id,
|
|
954
|
-
}
|
|
955
|
-
)
|
|
956
|
-
|
|
957
|
-
# ASSERT
|
|
958
|
-
self.assertFalse(
|
|
959
|
-
checkin.partner_id,
|
|
960
|
-
"Partner mustn't have been created and associated with the checkin",
|
|
961
|
-
)
|
|
962
|
-
|
|
963
826
|
def test_add_partner_data_from_checkin(self):
|
|
964
827
|
"""
|
|
965
828
|
If the checkin_partner has some data that the partner doesn't have,
|
|
@@ -977,32 +840,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
977
840
|
# ASSERT
|
|
978
841
|
self.assertTrue(self.host1.mobile, "Partner mobile must be added")
|
|
979
842
|
|
|
980
|
-
def test_partner_id_numbers_created_from_checkin(self):
|
|
981
|
-
"""
|
|
982
|
-
Some of the required data of the checkin_partner to create the partner are
|
|
983
|
-
document_type and document_number, with them an id_number is created associated
|
|
984
|
-
with the partner that has just been created. In this test it is verified that
|
|
985
|
-
this document has been created correctly
|
|
986
|
-
"""
|
|
987
|
-
# ACT & ARRANGE
|
|
988
|
-
checkin = self.env["pms.checkin.partner"].create(
|
|
989
|
-
{
|
|
990
|
-
"firstname": "Pepe",
|
|
991
|
-
"lastname": "Paz",
|
|
992
|
-
"document_type": self.id_category.id,
|
|
993
|
-
"document_number": "77156490T",
|
|
994
|
-
"reservation_id": self.reservation_1.id,
|
|
995
|
-
}
|
|
996
|
-
)
|
|
997
|
-
|
|
998
|
-
checkin.flush_recordset()
|
|
999
|
-
|
|
1000
|
-
# ASSERT
|
|
1001
|
-
self.assertTrue(
|
|
1002
|
-
checkin.partner_id.id_numbers,
|
|
1003
|
-
"Partner id_number should have been created and hasn't been",
|
|
1004
|
-
)
|
|
1005
|
-
|
|
1006
843
|
def _test_partner_not_modified_when_checkin_modified(self):
|
|
1007
844
|
"""
|
|
1008
845
|
If a partner is associated with a checkin
|
|
@@ -1034,47 +871,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
1034
871
|
"Checkin partner gender and partner gender shouldn't match",
|
|
1035
872
|
)
|
|
1036
873
|
|
|
1037
|
-
def test_add_partner_if_exists_from_checkin(self):
|
|
1038
|
-
"""
|
|
1039
|
-
Check when a document_type and document_number are entered in a checkin if this
|
|
1040
|
-
document already existes and is associated with a partner, this partner will be
|
|
1041
|
-
associated with the checkin
|
|
1042
|
-
"""
|
|
1043
|
-
# ACT
|
|
1044
|
-
host = self.env["res.partner"].create(
|
|
1045
|
-
{
|
|
1046
|
-
"name": "Ricardo",
|
|
1047
|
-
"mobile": "666555666",
|
|
1048
|
-
"email": "ricardo@example.com",
|
|
1049
|
-
"birthdate_date": "1995-11-14",
|
|
1050
|
-
"gender": "male",
|
|
1051
|
-
}
|
|
1052
|
-
)
|
|
1053
|
-
|
|
1054
|
-
self.env["res.partner.id_number"].create(
|
|
1055
|
-
{
|
|
1056
|
-
"category_id": self.id_category.id,
|
|
1057
|
-
"name": "55562998N",
|
|
1058
|
-
"partner_id": host.id,
|
|
1059
|
-
}
|
|
1060
|
-
)
|
|
1061
|
-
|
|
1062
|
-
# ARRANGE
|
|
1063
|
-
checkin = self.env["pms.checkin.partner"].create(
|
|
1064
|
-
{
|
|
1065
|
-
"document_type": self.id_category.id,
|
|
1066
|
-
"document_number": "55562998N",
|
|
1067
|
-
"reservation_id": self.reservation_1.id,
|
|
1068
|
-
}
|
|
1069
|
-
)
|
|
1070
|
-
|
|
1071
|
-
# ASSERT
|
|
1072
|
-
self.assertEqual(
|
|
1073
|
-
checkin.partner_id.id,
|
|
1074
|
-
host.id,
|
|
1075
|
-
"Checkin partner_id must be the same as the one who has that document",
|
|
1076
|
-
)
|
|
1077
|
-
|
|
1078
874
|
def test_is_possible_customer_by_email(self):
|
|
1079
875
|
"""
|
|
1080
876
|
It is checked that the field possible_existing_customer_ids
|
|
@@ -1321,240 +1117,6 @@ class TestPmsCheckinPartner(TestPms):
|
|
|
1321
1117
|
):
|
|
1322
1118
|
several_partners_wizard.add_partner()
|
|
1323
1119
|
|
|
1324
|
-
def test_calculate_dni_expedition_date_from_validity_date_age_lt_30(self):
|
|
1325
|
-
"""
|
|
1326
|
-
Check that the calculate_doc_type_expedition_date_from_validity_date()
|
|
1327
|
-
method calculates correctly the expedition_date of an id category DNI
|
|
1328
|
-
when the age is less than 30.
|
|
1329
|
-
-------------
|
|
1330
|
-
We launch the method calculate_doc_type_expedition_date_from_validity_date
|
|
1331
|
-
with the parameters doc_type_id DNI, birthdate calculated so that the age
|
|
1332
|
-
is = 20 years old and document_date = today + 1 year. The expected
|
|
1333
|
-
expedition date has to be doc_date - 5 years
|
|
1334
|
-
"""
|
|
1335
|
-
doc_date = fields.date.today() + relativedelta(years=1)
|
|
1336
|
-
doc_date_str = str(doc_date)
|
|
1337
|
-
|
|
1338
|
-
# age=20 years old
|
|
1339
|
-
birthdate = fields.date.today() - relativedelta(years=20)
|
|
1340
|
-
birthdate_str = str(birthdate)
|
|
1341
|
-
|
|
1342
|
-
# expected_expedition_date = doc_date - 5 years
|
|
1343
|
-
expected_exp_date = doc_date - relativedelta(years=5)
|
|
1344
|
-
expedition_date = (
|
|
1345
|
-
self.checkin1.calculate_doc_type_expedition_date_from_validity_date(
|
|
1346
|
-
self.id_category, doc_date_str, birthdate_str
|
|
1347
|
-
)
|
|
1348
|
-
)
|
|
1349
|
-
date_expedition_date = datetime.date(
|
|
1350
|
-
year=expedition_date.year,
|
|
1351
|
-
month=expedition_date.month,
|
|
1352
|
-
day=expedition_date.day,
|
|
1353
|
-
)
|
|
1354
|
-
self.assertEqual(
|
|
1355
|
-
date_expedition_date,
|
|
1356
|
-
expected_exp_date,
|
|
1357
|
-
"Expedition date doesn't correspond with expected expedition date",
|
|
1358
|
-
)
|
|
1359
|
-
|
|
1360
|
-
def test_calculate_dni_expedition_date_from_validity_date_age_gt_30(self):
|
|
1361
|
-
"""
|
|
1362
|
-
Check that the calculate_doc_type_expedition_date_from_validity_date()
|
|
1363
|
-
method calculates correctly the expedition_date of an id category DNI
|
|
1364
|
-
when the age is greater than 30.
|
|
1365
|
-
-------------
|
|
1366
|
-
We launch the method calculate_doc_type_expedition_date_from_validity_date
|
|
1367
|
-
with the parameters doc_type_id DNI, birthdate calculated so that the age
|
|
1368
|
-
is = 40 years old and document_date = today + 1 year. The expected
|
|
1369
|
-
expedition date has to be doc_date - 10 years
|
|
1370
|
-
"""
|
|
1371
|
-
doc_date = fields.date.today() + relativedelta(years=1)
|
|
1372
|
-
doc_date_str = str(doc_date)
|
|
1373
|
-
|
|
1374
|
-
# age=40 years old
|
|
1375
|
-
birthdate = fields.date.today() - relativedelta(years=40)
|
|
1376
|
-
birthdate_str = str(birthdate)
|
|
1377
|
-
|
|
1378
|
-
# expected_expedition_date = doc_date - 10 years
|
|
1379
|
-
expected_exp_date = doc_date - relativedelta(years=10)
|
|
1380
|
-
expedition_date = (
|
|
1381
|
-
self.checkin1.calculate_doc_type_expedition_date_from_validity_date(
|
|
1382
|
-
self.id_category, doc_date_str, birthdate_str
|
|
1383
|
-
)
|
|
1384
|
-
)
|
|
1385
|
-
date_expedition_date = datetime.date(
|
|
1386
|
-
year=expedition_date.year,
|
|
1387
|
-
month=expedition_date.month,
|
|
1388
|
-
day=expedition_date.day,
|
|
1389
|
-
)
|
|
1390
|
-
self.assertEqual(
|
|
1391
|
-
date_expedition_date,
|
|
1392
|
-
expected_exp_date,
|
|
1393
|
-
"Expedition date doesn't correspond with expected expedition date",
|
|
1394
|
-
)
|
|
1395
|
-
|
|
1396
|
-
def test_calculate_passport_expedition_date_from_validity_date_age_lt_30(self):
|
|
1397
|
-
"""
|
|
1398
|
-
Check that the calculate_doc_type_expedition_date_from_validity_date()
|
|
1399
|
-
method calculates correctly the expedition_date of an id category Passport
|
|
1400
|
-
when the age is less than 30.
|
|
1401
|
-
-------------
|
|
1402
|
-
We launch the method calculate_doc_type_expedition_date_from_validity_date
|
|
1403
|
-
with the parameters doc_type_id Passport, birthdate calculated so that the age
|
|
1404
|
-
is = 20 years old and document_date = today + 1 year. The expected
|
|
1405
|
-
expedition date has to be doc_date - 5 years
|
|
1406
|
-
"""
|
|
1407
|
-
doc_date = fields.date.today() + relativedelta(years=1)
|
|
1408
|
-
doc_date_str = str(doc_date)
|
|
1409
|
-
|
|
1410
|
-
# age=20 years old
|
|
1411
|
-
birthdate = fields.date.today() - relativedelta(years=20)
|
|
1412
|
-
birthdate_str = str(birthdate)
|
|
1413
|
-
|
|
1414
|
-
# expected_expedition_date = doc_date - 5 years
|
|
1415
|
-
expected_exp_date = doc_date - relativedelta(years=5)
|
|
1416
|
-
expedition_date = (
|
|
1417
|
-
self.checkin1.calculate_doc_type_expedition_date_from_validity_date(
|
|
1418
|
-
self.id_category, doc_date_str, birthdate_str
|
|
1419
|
-
)
|
|
1420
|
-
)
|
|
1421
|
-
date_expedition_date = datetime.date(
|
|
1422
|
-
year=expedition_date.year,
|
|
1423
|
-
month=expedition_date.month,
|
|
1424
|
-
day=expedition_date.day,
|
|
1425
|
-
)
|
|
1426
|
-
self.assertEqual(
|
|
1427
|
-
date_expedition_date,
|
|
1428
|
-
expected_exp_date,
|
|
1429
|
-
"Expedition date doesn't correspond with expected expedition date",
|
|
1430
|
-
)
|
|
1431
|
-
|
|
1432
|
-
def test_calculate_passport_expedition_date_from_validity_date_age_gt_30(self):
|
|
1433
|
-
"""
|
|
1434
|
-
Check that the calculate_doc_type_expedition_date_from_validity_date()
|
|
1435
|
-
method calculates correctly the expedition_date of an id category Passport
|
|
1436
|
-
when the age is greater than 30.
|
|
1437
|
-
-------------
|
|
1438
|
-
We launch the method calculate_doc_type_expedition_date_from_validity_date
|
|
1439
|
-
with the parameters doc_type_id Passport, birthdate calculated so that the age
|
|
1440
|
-
is = 40 years old and document_date = today + 1 year. The expected
|
|
1441
|
-
expedition date has to be doc_date - 10 years
|
|
1442
|
-
"""
|
|
1443
|
-
doc_type_id = self.env["res.partner.id_category"].search([("code", "=", "P")])
|
|
1444
|
-
doc_date = fields.date.today() + relativedelta(years=1)
|
|
1445
|
-
doc_date_str = str(doc_date)
|
|
1446
|
-
|
|
1447
|
-
# age=40 years old
|
|
1448
|
-
birthdate = fields.date.today() - relativedelta(years=40)
|
|
1449
|
-
birthdate_str = str(birthdate)
|
|
1450
|
-
|
|
1451
|
-
# expected_expedition_date = doc_date - 10 years
|
|
1452
|
-
expected_exp_date = doc_date - relativedelta(years=10)
|
|
1453
|
-
expedition_date = (
|
|
1454
|
-
self.checkin1.calculate_doc_type_expedition_date_from_validity_date(
|
|
1455
|
-
doc_type_id, doc_date_str, birthdate_str
|
|
1456
|
-
)
|
|
1457
|
-
)
|
|
1458
|
-
date_expedition_date = datetime.date(
|
|
1459
|
-
year=expedition_date.year,
|
|
1460
|
-
month=expedition_date.month,
|
|
1461
|
-
day=expedition_date.day,
|
|
1462
|
-
)
|
|
1463
|
-
self.assertEqual(
|
|
1464
|
-
date_expedition_date,
|
|
1465
|
-
expected_exp_date,
|
|
1466
|
-
"Expedition date doesn't correspond with expected expedition date",
|
|
1467
|
-
)
|
|
1468
|
-
|
|
1469
|
-
def test_calculate_expedition_date(self):
|
|
1470
|
-
"""
|
|
1471
|
-
Check that if the value of the doc_date is less than today,
|
|
1472
|
-
the method calculate_doc_type_expedition_date_from_validity_date
|
|
1473
|
-
returns the value of the doc_date as expedition_date.
|
|
1474
|
-
-----------
|
|
1475
|
-
We launch the method calculate_doc_type_expedition_date_from_validity_date
|
|
1476
|
-
with the parameters doc_type_id DNI, birthdate calculated so that the age
|
|
1477
|
-
is = 20 years old and document_date = today - 1 year. The expected
|
|
1478
|
-
expedition date has to be the value of doc_date.
|
|
1479
|
-
"""
|
|
1480
|
-
doc_type_id = self.env["res.partner.id_category"].search([("code", "=", "D")])
|
|
1481
|
-
doc_date = fields.date.today() - relativedelta(years=1)
|
|
1482
|
-
doc_date_str = str(doc_date)
|
|
1483
|
-
birthdate = fields.date.today() - relativedelta(years=20)
|
|
1484
|
-
birthdate_str = str(birthdate)
|
|
1485
|
-
expedition_date = (
|
|
1486
|
-
self.checkin1.calculate_doc_type_expedition_date_from_validity_date(
|
|
1487
|
-
doc_type_id, doc_date_str, birthdate_str
|
|
1488
|
-
)
|
|
1489
|
-
)
|
|
1490
|
-
date_expedition_date = datetime.date(
|
|
1491
|
-
year=expedition_date.year,
|
|
1492
|
-
month=expedition_date.month,
|
|
1493
|
-
day=expedition_date.day,
|
|
1494
|
-
)
|
|
1495
|
-
self.assertEqual(
|
|
1496
|
-
date_expedition_date,
|
|
1497
|
-
doc_date,
|
|
1498
|
-
"Expedition date doesn't correspond with expected expedition date",
|
|
1499
|
-
)
|
|
1500
|
-
|
|
1501
|
-
def test_save_checkin_from_portal(self):
|
|
1502
|
-
"""
|
|
1503
|
-
Check by subtesting that a checkin partner is saved correctly
|
|
1504
|
-
with the _save_data_from_portal() method.
|
|
1505
|
-
---------
|
|
1506
|
-
A reservation is created with an adult, and it will create a checkin partner.
|
|
1507
|
-
A dictionary is created with the values to be saved and with the key 'id'
|
|
1508
|
-
equal to the id of the checkin_partner created when the reservation was
|
|
1509
|
-
created. We launch the _save_data_from_portal() method, passing the created
|
|
1510
|
-
dictionary as a parameter. Then it is verified that the value of each key
|
|
1511
|
-
in the dictionary corresponds to the fields of the saved checkin_partner.
|
|
1512
|
-
"""
|
|
1513
|
-
self.reservation = self.env["pms.reservation"].create(
|
|
1514
|
-
{
|
|
1515
|
-
"checkin": datetime.date.today() + datetime.timedelta(days=10),
|
|
1516
|
-
"checkout": datetime.date.today() + datetime.timedelta(days=13),
|
|
1517
|
-
"room_type_id": self.room_type1.id,
|
|
1518
|
-
"partner_id": self.host1.id,
|
|
1519
|
-
"adults": 1,
|
|
1520
|
-
"pms_property_id": self.pms_property1.id,
|
|
1521
|
-
"sale_channel_origin_id": self.sale_channel_direct1.id,
|
|
1522
|
-
}
|
|
1523
|
-
)
|
|
1524
|
-
checkin_partner = self.reservation.checkin_partner_ids[0]
|
|
1525
|
-
checkin_partner_vals = {
|
|
1526
|
-
"checkin_partner": checkin_partner,
|
|
1527
|
-
"id": checkin_partner.id,
|
|
1528
|
-
"firstname": "Serafín",
|
|
1529
|
-
"lastname": "Rivas",
|
|
1530
|
-
"document_type": self.id_category,
|
|
1531
|
-
"document_number": "18038946T",
|
|
1532
|
-
"document_expedition_date": "07/10/2010",
|
|
1533
|
-
"birthdate_date": "05/10/1983",
|
|
1534
|
-
"mobile": "60595595",
|
|
1535
|
-
"email": "serafin@example.com",
|
|
1536
|
-
"gender": "male",
|
|
1537
|
-
"nationality_id": 1,
|
|
1538
|
-
"state_id": 1,
|
|
1539
|
-
}
|
|
1540
|
-
checkin_partner._save_data_from_portal(checkin_partner_vals)
|
|
1541
|
-
checkin_partner_vals.update(
|
|
1542
|
-
{
|
|
1543
|
-
"birthdate_date": datetime.date(1983, 10, 5),
|
|
1544
|
-
"document_expedition_date": datetime.date(2010, 10, 7),
|
|
1545
|
-
"nationality_id": self.env["res.country"].search([("id", "=", 1)]),
|
|
1546
|
-
"state_id": self.env["res.country.state"].browse(1),
|
|
1547
|
-
"document_type": self.id_category,
|
|
1548
|
-
}
|
|
1549
|
-
)
|
|
1550
|
-
for key in checkin_partner_vals:
|
|
1551
|
-
with self.subTest(k=key):
|
|
1552
|
-
self.assertEqual(
|
|
1553
|
-
self.reservation.checkin_partner_ids[0][key],
|
|
1554
|
-
checkin_partner_vals[key],
|
|
1555
|
-
"The value of " + key + " is not correctly established",
|
|
1556
|
-
)
|
|
1557
|
-
|
|
1558
1120
|
def test_compute_inverse_partner_fields(self):
|
|
1559
1121
|
"""
|
|
1560
1122
|
Check that the computes of the checkin_partner fields related to your partner
|
|
@@ -733,9 +733,6 @@ class TestPmsFolio(TestPms, AccountTestInvoicingCommon):
|
|
|
733
733
|
"email": "enrique@example.com",
|
|
734
734
|
}
|
|
735
735
|
)
|
|
736
|
-
self.id_category = self.env["res.partner.id_category"].create(
|
|
737
|
-
{"name": "DNI", "code": "D"}
|
|
738
|
-
)
|
|
739
736
|
# ACT
|
|
740
737
|
folio1 = self.env["pms.folio"].create(
|
|
741
738
|
{
|
|
@@ -769,9 +766,6 @@ class TestPmsFolio(TestPms, AccountTestInvoicingCommon):
|
|
|
769
766
|
"email": "simon@example.com",
|
|
770
767
|
}
|
|
771
768
|
)
|
|
772
|
-
self.id_category = self.env["res.partner.id_category"].create(
|
|
773
|
-
{"name": "DNI", "code": "D"}
|
|
774
|
-
)
|
|
775
769
|
|
|
776
770
|
# ACT
|
|
777
771
|
folio1 = self.env["pms.folio"].create(
|