mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: Room type capacity filter by property
This commit is contained in:
@@ -206,7 +206,9 @@ class PmsRoomType(models.Model):
|
||||
# record.product_id.unlink()
|
||||
# return super().unlink()
|
||||
|
||||
def get_capacity(self):
|
||||
def get_room_type_capacity(self, pms_property_id):
|
||||
self.ensure_one()
|
||||
capacities = self.room_ids.mapped("capacity")
|
||||
capacities = self.room_ids.filtered(
|
||||
lambda r: r.pms_property_id.id == pms_property_id
|
||||
).mapped("capacity")
|
||||
return min(capacities) if any(capacities) else 0
|
||||
|
||||
@@ -465,7 +465,7 @@ class AvailabilityWizard(models.TransientModel):
|
||||
board_service_room_id
|
||||
)
|
||||
nights = (checkout - checkin).days
|
||||
adults = adults or room_type.get_capacity()
|
||||
adults = adults or room_type.get_room_type_capacity(pms_property_id)
|
||||
room_type_total_price_per_room += (
|
||||
board_service_room.amount * nights * adults
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user