From 33b0903f54e7b428e8fa2835b908da157c90f805 Mon Sep 17 00:00:00 2001 From: miguelpadin Date: Fri, 5 Feb 2021 11:13:33 +0100 Subject: [PATCH] [FIX] pms-pwa: fix compute priority --- pms/models/pms_reservation.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pms/models/pms_reservation.py b/pms/models/pms_reservation.py index ab5bc9d92..a455231d3 100644 --- a/pms/models/pms_reservation.py +++ b/pms/models/pms_reservation.py @@ -525,15 +525,16 @@ class PmsReservation(models.Model): def _compute_priority(self): for record in self: record.priority = 0 - if any( - [ - not record.to_assign, - not record.left_for_checkin, - record.left_for_checkout, - record.state == "onboard" and record.folio_pending_amount > 0, - ] - ): + + # we can give weights for each condition + if not record.to_assign: record.priority += 1 + if not record.left_for_checkin: + record.priority += 10 + if record.left_for_checkout: + record.priority += 100 + if record.state == "onboard" and record.folio_pending_amount > 0: + record.priority += 1000 @api.depends("pricelist_id", "room_type_id") def _compute_board_service_room_id(self):