mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] pms: minor bugfixes
This commit is contained in:
@@ -450,7 +450,7 @@ class FolioSaleLine(models.Model):
|
|||||||
currency=line.folio_id.currency_id,
|
currency=line.folio_id.currency_id,
|
||||||
quantity=line.product_uom_qty,
|
quantity=line.product_uom_qty,
|
||||||
product=line.product_id,
|
product=line.product_id,
|
||||||
partner=line.folio_id.partner_shipping_id,
|
partner=line.folio_id.partner_id,
|
||||||
)["total_excluded"]
|
)["total_excluded"]
|
||||||
|
|
||||||
if any(
|
if any(
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ class PmsFolio(models.Model):
|
|||||||
store="True",
|
store="True",
|
||||||
compute="_compute_number_of_rooms",
|
compute="_compute_number_of_rooms",
|
||||||
)
|
)
|
||||||
|
number_of_cancelled_rooms = fields.Integer(
|
||||||
|
string="Number of Cancelled Rooms",
|
||||||
|
help="Number of cancelled rooms in folio.",
|
||||||
|
store="True",
|
||||||
|
compute="_compute_number_of_cancelled_rooms",
|
||||||
|
)
|
||||||
number_of_services = fields.Integer(
|
number_of_services = fields.Integer(
|
||||||
string="Number of Services",
|
string="Number of Services",
|
||||||
help="Number of services in the folio",
|
help="Number of services in the folio",
|
||||||
@@ -203,10 +209,6 @@ class PmsFolio(models.Model):
|
|||||||
store=True,
|
store=True,
|
||||||
compute="_compute_count_rooms_pending_arrival",
|
compute="_compute_count_rooms_pending_arrival",
|
||||||
)
|
)
|
||||||
checkins_ratio = fields.Integer(
|
|
||||||
string="Pending Arrival Ratio",
|
|
||||||
compute="_compute_checkins_ratio",
|
|
||||||
)
|
|
||||||
pending_checkin_data = fields.Integer(
|
pending_checkin_data = fields.Integer(
|
||||||
string="Checkin Data",
|
string="Checkin Data",
|
||||||
compute="_compute_pending_checkin_data",
|
compute="_compute_pending_checkin_data",
|
||||||
@@ -396,14 +398,6 @@ class PmsFolio(models.Model):
|
|||||||
compute="_compute_amount_all",
|
compute="_compute_amount_all",
|
||||||
tracking=True,
|
tracking=True,
|
||||||
)
|
)
|
||||||
reservation_pending_arrival_ids = fields.One2many(
|
|
||||||
string="Pending Arrival Rooms",
|
|
||||||
comodel_name="pms.checkin.partner",
|
|
||||||
compute="_compute_reservations_pending_arrival",
|
|
||||||
)
|
|
||||||
reservations_pending_count = fields.Integer(
|
|
||||||
compute="_compute_reservations_pending_arrival"
|
|
||||||
)
|
|
||||||
max_reservation_priority = fields.Integer(
|
max_reservation_priority = fields.Integer(
|
||||||
string="Max reservation priority on the entire folio",
|
string="Max reservation priority on the entire folio",
|
||||||
help="Max reservation priority on the entire folio",
|
help="Max reservation priority on the entire folio",
|
||||||
@@ -581,6 +575,13 @@ class PmsFolio(models.Model):
|
|||||||
folio.reservation_ids.filtered(lambda a: a.state != "cancelled")
|
folio.reservation_ids.filtered(lambda a: a.state != "cancelled")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.depends("reservation_ids", "reservation_ids.state")
|
||||||
|
def _compute_number_of_cancelled_rooms(self):
|
||||||
|
for folio in self:
|
||||||
|
folio.number_of_cancelled_rooms = len(
|
||||||
|
folio.reservation_ids.filtered(lambda a: a.state == "cancelled")
|
||||||
|
)
|
||||||
|
|
||||||
@api.depends("service_ids", "service_ids.product_qty")
|
@api.depends("service_ids", "service_ids.product_qty")
|
||||||
def _compute_number_of_services(self):
|
def _compute_number_of_services(self):
|
||||||
for folio in self:
|
for folio in self:
|
||||||
@@ -1132,11 +1133,13 @@ class PmsFolio(models.Model):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def action_confirm(self):
|
def action_confirm(self):
|
||||||
for folio in self.filtered(
|
self.filtered(lambda x: x.state != "confirm").write(
|
||||||
lambda folio: folio.partner_id not in folio.message_partner_ids
|
{"state": "confirm", "confirmation_date": fields.Datetime.now()}
|
||||||
):
|
)
|
||||||
folio.message_subscribe([folio.partner_id.id])
|
|
||||||
self.write({"state": "confirm", "confirmation_date": fields.Datetime.now()})
|
if self.env.context.get("confirm_all_reservations"):
|
||||||
|
self.reservation_ids.confirm()
|
||||||
|
|
||||||
# if self.env.context.get('send_email'):
|
# if self.env.context.get('send_email'):
|
||||||
# self.force_quotation_send()
|
# self.force_quotation_send()
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,20 @@
|
|||||||
string="Rooms"
|
string="Rooms"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
type="action"
|
||||||
|
class="oe_stat_button"
|
||||||
|
name="%(open_pms_reservation_form_tree_all)d"
|
||||||
|
icon="fa-window-close"
|
||||||
|
context="{'search_default_folio_id': id, 'default_folio_id': id, 'search_default_cancelled': True}"
|
||||||
|
attrs="{'invisible': [('number_of_cancelled_rooms', '=', 0)]}"
|
||||||
|
>
|
||||||
|
<field
|
||||||
|
name="number_of_cancelled_rooms"
|
||||||
|
widget="statinfo"
|
||||||
|
string="Cancelled Rooms"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
type="action"
|
type="action"
|
||||||
class="oe_stat_button"
|
class="oe_stat_button"
|
||||||
|
|||||||
Reference in New Issue
Block a user