mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] priority tests
This commit is contained in:
@@ -222,8 +222,9 @@ class PmsCheckinPartner(models.Model):
|
||||
)
|
||||
def _compute_document_expedition_date(self):
|
||||
for record in self:
|
||||
if record.partner_id and record.partner_id.id_numbers:
|
||||
if not record.document_expedition_date:
|
||||
if not record.document_expedition_date:
|
||||
record.document_expedition_date = False
|
||||
if record.partner_id and record.partner_id.id_numbers:
|
||||
record.document_expedition_date = record.partner_id.id_numbers[
|
||||
0
|
||||
].valid_from
|
||||
|
||||
@@ -611,6 +611,12 @@ class PmsReservation(models.Model):
|
||||
elif record.state == "cancelled":
|
||||
if record.pending_amount > 0:
|
||||
record.priority = 2
|
||||
elif record.checkout >= fields.date.today():
|
||||
record.priority = 100
|
||||
else:
|
||||
record.priority = (
|
||||
1000 * (fields.date.today() - record.checkout).days
|
||||
)
|
||||
elif record.state == "onboard":
|
||||
record.priority = record.onboard_priority()
|
||||
elif record.state in ("draf", "confirm"):
|
||||
|
||||
@@ -20,24 +20,23 @@
|
||||
#
|
||||
##############################################################################
|
||||
from . import test_pms_reservation
|
||||
|
||||
# from . import test_pms_pricelist
|
||||
# from . import test_pms_checkin_partner
|
||||
# from . import test_pms_sale_channel
|
||||
# from . import test_pms_folio
|
||||
# from . import test_pms_availability_plan_rules
|
||||
# from . import test_pms_room_type
|
||||
# from . import test_pms_room_type_class
|
||||
# from . import test_pms_board_service
|
||||
# from . import test_pms_wizard_massive_changes
|
||||
# from . import test_pms_booking_engine
|
||||
# from . import test_pms_res_users
|
||||
# from . import test_pms_amenity
|
||||
# from . import test_pms_room
|
||||
# from . import test_pms_board_service_line
|
||||
# from . import test_pms_board_service_room_type
|
||||
# from . import test_pms_board_service_room_type_line
|
||||
# from . import test_pms_folio_invoice
|
||||
# from . import test_pms_folio_sale_line
|
||||
# from . import test_pms_wizard_split_join_swap_reservation
|
||||
# from . import test_product_template
|
||||
from . import test_pms_pricelist
|
||||
from . import test_pms_checkin_partner
|
||||
from . import test_pms_sale_channel
|
||||
from . import test_pms_folio
|
||||
from . import test_pms_availability_plan_rules
|
||||
from . import test_pms_room_type
|
||||
from . import test_pms_room_type_class
|
||||
from . import test_pms_board_service
|
||||
from . import test_pms_wizard_massive_changes
|
||||
from . import test_pms_booking_engine
|
||||
from . import test_pms_res_users
|
||||
from . import test_pms_amenity
|
||||
from . import test_pms_room
|
||||
from . import test_pms_board_service_line
|
||||
from . import test_pms_board_service_room_type
|
||||
from . import test_pms_board_service_room_type_line
|
||||
from . import test_pms_folio_invoice
|
||||
from . import test_pms_folio_sale_line
|
||||
from . import test_pms_wizard_split_join_swap_reservation
|
||||
from . import test_product_template
|
||||
|
||||
@@ -741,14 +741,14 @@ class TestPmsReservations(common.SavepointCase):
|
||||
self.create_common_scenario()
|
||||
r1 = self.env["pms.reservation"].create(
|
||||
{
|
||||
"checkin": fields.date.today(),
|
||||
"checkout": fields.date.today() + datetime.timedelta(days=1),
|
||||
"checkin": fields.date.today() + datetime.timedelta(days=3),
|
||||
"checkout": fields.date.today() + datetime.timedelta(days=4),
|
||||
"room_type_id": self.room_type_double.id,
|
||||
"partner_id": self.env.ref("base.res_partner_12").id,
|
||||
"pms_property_id": self.property.id,
|
||||
}
|
||||
)
|
||||
self.env["pms.reservation"].create(
|
||||
r2 = self.env["pms.reservation"].create(
|
||||
{
|
||||
"checkin": fields.date.today(),
|
||||
"checkout": fields.date.today() + datetime.timedelta(days=1),
|
||||
@@ -757,7 +757,7 @@ class TestPmsReservations(common.SavepointCase):
|
||||
"pms_property_id": self.property.id,
|
||||
}
|
||||
)
|
||||
r1.action_assign()
|
||||
r2.action_assign()
|
||||
# ACT
|
||||
reservations = self.env["pms.reservation"].search(
|
||||
[("pms_property_id", "=", self.property.id)]
|
||||
@@ -800,9 +800,6 @@ class TestPmsReservations(common.SavepointCase):
|
||||
def test_order_priority_checkout(self):
|
||||
# ARRANGE
|
||||
self.create_common_scenario()
|
||||
id_category = self.env["res.partner.id_category"].create(
|
||||
{"name": "DNI", "code": "D"}
|
||||
)
|
||||
self.host1 = self.env["res.partner"].create(
|
||||
{
|
||||
"firstname": "Pepe",
|
||||
@@ -843,7 +840,7 @@ class TestPmsReservations(common.SavepointCase):
|
||||
{
|
||||
"partner_id": self.host1.id,
|
||||
"reservation_id": r1.id,
|
||||
"document_type": id_category.id,
|
||||
"document_type": self.id_category.id,
|
||||
"document_number": "77156490T",
|
||||
"document_expedition_date": fields.date.today()
|
||||
+ datetime.timedelta(days=665),
|
||||
@@ -851,9 +848,9 @@ class TestPmsReservations(common.SavepointCase):
|
||||
)
|
||||
checkin2 = self.env["pms.checkin.partner"].create(
|
||||
{
|
||||
"partner_id": self.host1.id,
|
||||
"partner_id": self.host2.id,
|
||||
"reservation_id": r2.id,
|
||||
"document_type": id_category.id,
|
||||
"document_type": self.id_category.id,
|
||||
"document_number": "55562998N",
|
||||
"document_expedition_date": fields.date.today()
|
||||
+ datetime.timedelta(days=665),
|
||||
|
||||
Reference in New Issue
Block a user