[FIX] pms: ValueError: Invalid field 'document_type' on model 'pms.folio'

field is removed in commit: b6603a6aeb
This commit is contained in:
bosd
2023-11-14 11:33:19 +01:00
committed by Darío Lodeiros
parent 05354170c2
commit 4b84f8a58e
2 changed files with 13 additions and 75 deletions

View File

@@ -731,22 +731,15 @@ class TestPmsFolio(TestPms):
""" """
Check that a res_partner is created from a folio. Check that a res_partner is created from a folio.
------------ ------------
A folio is created by adding the document_type and A folio is created by adding the property_id a res.partner
document_number fields, with these two fields a res.partner
should be created, which is what is checked after creating should be created, which is what is checked after creating
the folio. the folio.
""" """
# ARRANGE
self.id_category = self.env["res.partner.id_category"].create(
{"name": "DNI", "code": "D"}
)
# ACT # ACT
folio1 = self.env["pms.folio"].create( folio1 = self.env["pms.folio"].create(
{ {
"pms_property_id": self.pms_property1.id, "pms_property_id": self.pms_property1.id,
"partner_name": "Savannah Byles", "partner_name": "Savannah Byles",
"document_type": self.id_category.id,
"document_number": "32861114W",
} }
) )
# ASSERT # ASSERT
@@ -755,15 +748,11 @@ class TestPmsFolio(TestPms):
def test_auto_complete_partner_mobile(self): def test_auto_complete_partner_mobile(self):
""" """
It is checked that the mobile field of the folio It is checked that the mobile field of the folio
is correctly added to it when the document_number and is correctly added to
document_type fields of a res.partner that exists in a res.partner that exists in
the DB are put in the folio. the DB are put in the folio.
-------------------- --------------------
A res.partner is created with the name, mobile and email fields. A res.partner is created with the name, mobile and email fields.
The document_id is added to the res.partner. The folio is
created and the category_id of the document_id associated with
the res.partner is added as document_type and as document_number
the name of the document_id associated with the res.partner as well.
Then it is checked that the mobile of the res.partner and that of Then it is checked that the mobile of the res.partner and that of
the folio are the same. the folio are the same.
""" """
@@ -778,20 +767,11 @@ class TestPmsFolio(TestPms):
self.id_category = self.env["res.partner.id_category"].create( self.id_category = self.env["res.partner.id_category"].create(
{"name": "DNI", "code": "D"} {"name": "DNI", "code": "D"}
) )
self.document_id = self.env["res.partner.id_number"].create(
{
"category_id": self.id_category.id,
"name": "61645604S",
"partner_id": partner.id,
}
)
# ACT # ACT
folio1 = self.env["pms.folio"].create( folio1 = self.env["pms.folio"].create(
{ {
"pms_property_id": self.pms_property1.id, "pms_property_id": self.pms_property1.id,
"partner_name": partner.name, "partner_name": partner.name,
"document_type": self.document_id.category_id.id,
"document_number": self.document_id.name,
} }
) )
# ASSERT # ASSERT
@@ -804,15 +784,11 @@ class TestPmsFolio(TestPms):
def test_auto_complete_partner_email(self): def test_auto_complete_partner_email(self):
""" """
It is checked that the email field of the folio It is checked that the email field of the folio
is correctly added to it when the document_number and is correctly added to
document_type fields of a res.partner that exists in a res.partner that exists in
the DB are put in the folio. the DB are put in the folio.
-------------------- --------------------
A res.partner is created with the name, mobile and email fields. A res.partner is created with the name, mobile and email fields.
The document_id is added to the res.partner. The folio is
created and the category_id of the document_id associated with
the res.partner is added as document_type and as document_number
the name of the document_id associated with the res.partner as well.
Then it is checked that the email of the res.partner and that of Then it is checked that the email of the res.partner and that of
the folio are the same. the folio are the same.
""" """
@@ -827,21 +803,12 @@ class TestPmsFolio(TestPms):
self.id_category = self.env["res.partner.id_category"].create( self.id_category = self.env["res.partner.id_category"].create(
{"name": "DNI", "code": "D"} {"name": "DNI", "code": "D"}
) )
self.document_id = self.env["res.partner.id_number"].create(
{
"category_id": self.id_category.id,
"name": "74247377L",
"partner_id": partner.id,
}
)
# ACT # ACT
folio1 = self.env["pms.folio"].create( folio1 = self.env["pms.folio"].create(
{ {
"pms_property_id": self.pms_property1.id, "pms_property_id": self.pms_property1.id,
"partner_name": partner.name, "partner_name": partner.name,
"document_type": self.document_id.category_id.id,
"document_number": self.document_id.name,
} }
) )
# ASSERT # ASSERT

View File

@@ -842,8 +842,6 @@ class TestPmsReservations(TestPms):
# { # {
# "partner_id": host1.id, # "partner_id": host1.id,
# "reservation_id": res.id, # "reservation_id": res.id,
# "document_type": self.id_category.id,
# "document_number": "77156490T",
# "document_expedition_date": fields.date.today() # "document_expedition_date": fields.date.today()
# + datetime.timedelta(days=665), # + datetime.timedelta(days=665),
# } # }
@@ -946,8 +944,6 @@ class TestPmsReservations(TestPms):
{ {
"partner_id": host1.id, "partner_id": host1.id,
"reservation_id": res.id, "reservation_id": res.id,
"document_type": self.id_category.id,
"document_number": "77156490T",
"document_expedition_date": fields.date.today() "document_expedition_date": fields.date.today()
+ datetime.timedelta(days=665), + datetime.timedelta(days=665),
} }
@@ -1016,8 +1012,6 @@ class TestPmsReservations(TestPms):
{ {
"partner_id": host1.id, "partner_id": host1.id,
"reservation_id": res.id, "reservation_id": res.id,
"document_type": self.id_category.id,
"document_number": "77156490T",
"document_expedition_date": fields.date.today() "document_expedition_date": fields.date.today()
+ datetime.timedelta(days=665), + datetime.timedelta(days=665),
} }
@@ -1116,8 +1110,6 @@ class TestPmsReservations(TestPms):
{ {
"partner_id": host1.id, "partner_id": host1.id,
"reservation_id": res.id, "reservation_id": res.id,
"document_type": self.id_category.id,
"document_number": "77156490T",
"document_expedition_date": fields.date.today() "document_expedition_date": fields.date.today()
+ datetime.timedelta(days=665), + datetime.timedelta(days=665),
} }
@@ -1182,8 +1174,6 @@ class TestPmsReservations(TestPms):
{ {
"partner_id": host1.id, "partner_id": host1.id,
"reservation_id": res.id, "reservation_id": res.id,
"document_type": self.id_category.id,
"document_number": "77156490T",
"document_expedition_date": fields.date.today() "document_expedition_date": fields.date.today()
+ datetime.timedelta(days=665), + datetime.timedelta(days=665),
} }
@@ -1339,8 +1329,6 @@ class TestPmsReservations(TestPms):
{ {
"partner_id": host1.id, "partner_id": host1.id,
"reservation_id": res.id, "reservation_id": res.id,
"document_type": self.id_category.id,
"document_number": "77156490T",
"document_expedition_date": fields.date.today() "document_expedition_date": fields.date.today()
+ datetime.timedelta(days=665), + datetime.timedelta(days=665),
} }
@@ -1418,8 +1406,6 @@ class TestPmsReservations(TestPms):
{ {
"partner_id": host1.id, "partner_id": host1.id,
"reservation_id": res.id, "reservation_id": res.id,
"document_type": self.id_category.id,
"document_number": "77156490T",
"document_expedition_date": fields.date.today() "document_expedition_date": fields.date.today()
+ datetime.timedelta(days=665), + datetime.timedelta(days=665),
} }
@@ -1497,8 +1483,6 @@ class TestPmsReservations(TestPms):
{ {
"partner_id": host1.id, "partner_id": host1.id,
"reservation_id": res.id, "reservation_id": res.id,
"document_type": self.id_category.id,
"document_number": "77156490T",
"document_expedition_date": fields.date.today() "document_expedition_date": fields.date.today()
+ datetime.timedelta(days=665), + datetime.timedelta(days=665),
} }
@@ -3358,9 +3342,9 @@ class TestPmsReservations(TestPms):
""" """
Check that a res_partner is created from a reservation. Check that a res_partner is created from a reservation.
------------ ------------
A reservation is created by adding the document_type and A reservation is created
document_number fields, with these two fields a res.partner and a res.partner
should be created, which is what is checked after creating should also be created, which is what is checked after creating
the reservation. the reservation.
""" """
# ARRANGE # ARRANGE
@@ -3379,8 +3363,6 @@ class TestPmsReservations(TestPms):
"partner_name": "Elis", "partner_name": "Elis",
"email": "elis@mail.com", "email": "elis@mail.com",
"mobile": "61568547", "mobile": "61568547",
"document_type": self.id_category.id,
"document_number": "31640132K",
"sale_channel_origin_id": self.sale_channel_direct.id, "sale_channel_origin_id": self.sale_channel_direct.id,
} }
) )
@@ -3391,15 +3373,11 @@ class TestPmsReservations(TestPms):
def test_auto_complete_partner_mobile(self): def test_auto_complete_partner_mobile(self):
""" """
It is checked that the mobile field of the reservation It is checked that the mobile field of the reservation
is correctly added to it when the document_number and is correctly added to
document_type fields of a res.partner that exists in a res.partner that exists in
the DB are put in the reservation. the DB are put in the reservation.
-------------------- --------------------
A res.partner is created with the name, mobile and email fields. A res.partner is created with the name, mobile and email fields.
The document_id is added to the res.partner. The reservation is
created and the category_id of the document_id associated with
the res.partner is added as document_type and as document_number
the name of the document_id associated with the res.partner as well.
Then it is verified that the mobile of the res.partner and that of Then it is verified that the mobile of the res.partner and that of
the reservation are the same. the reservation are the same.
""" """
@@ -3431,8 +3409,6 @@ class TestPmsReservations(TestPms):
"room_type_id": self.room_type_double.id, "room_type_id": self.room_type_double.id,
"pms_property_id": self.pms_property1.id, "pms_property_id": self.pms_property1.id,
"partner_name": partner.name, "partner_name": partner.name,
"document_type": self.document_id.category_id.id,
"document_number": self.document_id.name,
"sale_channel_origin_id": self.sale_channel_direct.id, "sale_channel_origin_id": self.sale_channel_direct.id,
} }
) )
@@ -3447,15 +3423,12 @@ class TestPmsReservations(TestPms):
def test_auto_complete_partner_email(self): def test_auto_complete_partner_email(self):
""" """
It is checked that the email field of the reservation It is checked that the email field of the reservation
is correctly added to it when the document_number and is correctly added to
document_type fields of a res.partner that exists in a res.partner that exists in
the DB are put in the reservation. the DB are put in the reservation.
-------------------- --------------------
A res.partner is created with the name, mobile and email fields. A res.partner is created with the name, mobile and email fields.
The document_id is added to the res.partner. The reservation is The document_id is added to the res.partner.
created and the category_id of the document_id associated with
the res.partner is added as document_type and as document_number
the name of the document_id associated with the res.partner as well.
Then it is verified that the email of the res.partner and that of Then it is verified that the email of the res.partner and that of
the reservation are the same. the reservation are the same.
""" """
@@ -3487,8 +3460,6 @@ class TestPmsReservations(TestPms):
"room_type_id": self.room_type_double.id, "room_type_id": self.room_type_double.id,
"pms_property_id": self.pms_property1.id, "pms_property_id": self.pms_property1.id,
"partner_name": partner.name, "partner_name": partner.name,
"document_type": self.document_id.category_id.id,
"document_number": self.document_id.name,
"sale_channel_origin_id": self.sale_channel_direct.id, "sale_channel_origin_id": self.sale_channel_direct.id,
} }
) )