mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] Multiproperty checks
This commit is contained in:
@@ -35,6 +35,7 @@ class FolioWizard(models.TransientModel):
|
||||
help="Property to which the folio belongs",
|
||||
default=lambda self: self._default_pms_property_id(),
|
||||
comodel_name="pms.property",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
segmentation_ids = fields.Many2many(
|
||||
string="Segmentation",
|
||||
|
||||
@@ -81,7 +81,7 @@ class AvailabilityWizard(models.TransientModel):
|
||||
help="Board Service included in the room",
|
||||
comodel_name="pms.board.service.room.type",
|
||||
domain="[('pms_room_type_id','=',room_type_id)]",
|
||||
tracking=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
|
||||
@api.depends("room_type_id", "checkin", "checkout")
|
||||
|
||||
@@ -16,6 +16,7 @@ class AvailabilityWizard(models.TransientModel):
|
||||
default=lambda self: self.env["pms.property"].browse(
|
||||
self.env.user.get_active_property_ids()[0]
|
||||
),
|
||||
check_pms_properties=True,
|
||||
)
|
||||
massive_changes_on = fields.Selection(
|
||||
string="On",
|
||||
|
||||
@@ -6,10 +6,11 @@ from odoo.exceptions import UserError
|
||||
|
||||
class ReservationSplitJoinSwapWizard(models.TransientModel):
|
||||
_name = "pms.reservation.split.join.swap.wizard"
|
||||
string = ("Operation",)
|
||||
help = ("Operation to be applied on the reservation",)
|
||||
|
||||
operation = fields.Selection(
|
||||
[
|
||||
string="Operation",
|
||||
help="Operation to be applied on the reservation",
|
||||
selection=[
|
||||
("swap", "Swap rooms"),
|
||||
("split", "Split reservation"),
|
||||
("join", "Join reservation"),
|
||||
@@ -45,7 +46,7 @@ class ReservationSplitJoinSwapWizard(models.TransientModel):
|
||||
if self._context.get("active_id")
|
||||
else False,
|
||||
)
|
||||
reservations = fields.Many2many(
|
||||
reservation_ids = fields.Many2many(
|
||||
string="Reservations",
|
||||
readonly=False,
|
||||
store=True,
|
||||
@@ -100,7 +101,7 @@ class ReservationSplitJoinSwapWizard(models.TransientModel):
|
||||
)
|
||||
|
||||
@api.depends("checkin", "checkout", "room_source", "room_target")
|
||||
def _compute_reservations(self):
|
||||
def _compute_reservation_ids(self):
|
||||
for record in self:
|
||||
if record.checkin and record.checkout:
|
||||
reservation_ids = list()
|
||||
@@ -131,9 +132,9 @@ class ReservationSplitJoinSwapWizard(models.TransientModel):
|
||||
)
|
||||
.sorted("rooms")
|
||||
)
|
||||
record.reservations = reservations
|
||||
record.reservation_ids = reservations
|
||||
else:
|
||||
record.reservations = False
|
||||
record.reservation_ids = False
|
||||
|
||||
@api.depends("reservation_id")
|
||||
def _compute_reservation_lines(self):
|
||||
@@ -160,7 +161,7 @@ class ReservationSplitJoinSwapWizard(models.TransientModel):
|
||||
def _compute_allowed_rooms_source(self):
|
||||
for record in self:
|
||||
record.allowed_rooms_sources = (
|
||||
record.reservations.reservation_line_ids.mapped("room_id")
|
||||
record.reservation_ids.reservation_line_ids.mapped("room_id")
|
||||
)
|
||||
|
||||
@api.depends_context("default_operation")
|
||||
@@ -187,7 +188,7 @@ class ReservationSplitJoinSwapWizard(models.TransientModel):
|
||||
(
|
||||
"id",
|
||||
"in",
|
||||
record.reservations.reservation_line_ids.mapped(
|
||||
record.reservation_ids.reservation_line_ids.mapped(
|
||||
"room_id"
|
||||
).ids,
|
||||
)
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
class="col-12"
|
||||
attrs="{'invisible': [('operation','!=','swap')]}"
|
||||
>
|
||||
<field name="reservations" nolabel="1" readonly="1">
|
||||
<field name="reservation_ids" nolabel="1" readonly="1">
|
||||
<tree>
|
||||
<field string="Reservation" name="name" />
|
||||
<field name="checkin" />
|
||||
|
||||
Reference in New Issue
Block a user