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:
@@ -3,12 +3,14 @@ from odoo import fields, models
|
||||
|
||||
class AccountBankStatement(models.Model):
|
||||
_inherit = "account.bank.statement"
|
||||
_check_pms_properties_auto = True
|
||||
|
||||
property_id = fields.Many2one(
|
||||
pms_property_id = fields.Many2one(
|
||||
string="Property",
|
||||
help="Properties with access to the element",
|
||||
copy=False,
|
||||
comodel_name="pms.property",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
company_id = fields.Many2one(
|
||||
string="Company",
|
||||
|
||||
@@ -3,6 +3,7 @@ from odoo import fields, models
|
||||
|
||||
class AccountJournal(models.Model):
|
||||
_inherit = "account.journal"
|
||||
_check_pms_properties_auto = True
|
||||
|
||||
pms_property_ids = fields.Many2many(
|
||||
string="Properties",
|
||||
|
||||
@@ -31,6 +31,7 @@ class PmsAvailability(models.Model):
|
||||
required=True,
|
||||
comodel_name="pms.property",
|
||||
ondelete="restrict",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
reservation_line_ids = fields.One2many(
|
||||
string="Reservation Lines",
|
||||
|
||||
@@ -85,6 +85,7 @@ class PmsAvailabilityPlanRule(models.Model):
|
||||
ondelete="restrict",
|
||||
required=True,
|
||||
comodel_name="pms.property",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
avail_id = fields.Many2one(
|
||||
string="Avail record",
|
||||
|
||||
@@ -49,6 +49,7 @@ class PmsCheckinPartner(models.Model):
|
||||
store=True,
|
||||
comodel_name="pms.property",
|
||||
related="folio_id.pms_property_id",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
name = fields.Char(
|
||||
string="Name",
|
||||
|
||||
@@ -34,6 +34,7 @@ class PmsFolio(models.Model):
|
||||
comodel_name="pms.property",
|
||||
required=True,
|
||||
default=lambda self: self.env.user.get_active_property_ids()[0],
|
||||
check_pms_properties=True,
|
||||
)
|
||||
partner_id = fields.Many2one(
|
||||
string="Partner",
|
||||
|
||||
@@ -139,6 +139,7 @@ class PmsReservation(models.Model):
|
||||
default=lambda self: self.env.user.get_active_property_ids()[0],
|
||||
related="folio_id.pms_property_id",
|
||||
comodel_name="pms.property",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
reservation_line_ids = fields.One2many(
|
||||
string="Reservation Lines",
|
||||
@@ -650,10 +651,9 @@ class PmsReservation(models.Model):
|
||||
"reservation_line_ids.date",
|
||||
"reservation_line_ids.room_id",
|
||||
"reservation_line_ids.occupies_availability",
|
||||
"overbooking",
|
||||
"state",
|
||||
"preferred_room_id",
|
||||
"pricelist_id",
|
||||
"pms_property_id",
|
||||
)
|
||||
def _compute_allowed_room_ids(self):
|
||||
for reservation in self:
|
||||
|
||||
@@ -54,6 +54,7 @@ class PmsReservationLine(models.Model):
|
||||
store=True,
|
||||
comodel_name="pms.property",
|
||||
related="reservation_id.pms_property_id",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
date = fields.Date(
|
||||
string="Date",
|
||||
@@ -105,7 +106,7 @@ class PmsReservationLine(models.Model):
|
||||
)
|
||||
impacts_quota = fields.Integer(
|
||||
string="Impacts quota",
|
||||
help="",
|
||||
help="This line has been taken into account in the avail quota",
|
||||
readonly=False,
|
||||
store=True,
|
||||
compute="_compute_impact_quota",
|
||||
|
||||
@@ -6,7 +6,6 @@ from odoo import fields, models
|
||||
class RoomClosureReason(models.Model):
|
||||
_name = "room.closure.reason"
|
||||
_description = "Cause of out of service"
|
||||
_check_pms_properties_auto = True
|
||||
|
||||
name = fields.Char(
|
||||
string="Name",
|
||||
@@ -23,7 +22,6 @@ class RoomClosureReason(models.Model):
|
||||
column1="room_closure_reason_type_id",
|
||||
column2="pms_property_id",
|
||||
ondelete="restrict",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
description = fields.Text(
|
||||
string="Description",
|
||||
|
||||
@@ -31,7 +31,6 @@ class PmsRoomType(models.Model):
|
||||
required=True,
|
||||
delegate=True,
|
||||
ondelete="cascade",
|
||||
# check_pms_properties=True,
|
||||
)
|
||||
room_ids = fields.One2many(
|
||||
string="Rooms",
|
||||
|
||||
@@ -16,6 +16,7 @@ class PmsRoomTypeClass(models.Model):
|
||||
_name = "pms.room.type.class"
|
||||
_description = "Room Type Class"
|
||||
_order = "sequence, name, default_code"
|
||||
_check_pms_properties_auto = True
|
||||
|
||||
name = fields.Char(
|
||||
string="Class Name",
|
||||
|
||||
@@ -78,6 +78,7 @@ class PmsService(models.Model):
|
||||
store=True,
|
||||
comodel_name="pms.property",
|
||||
related="folio_id.pms_property_id",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
tax_ids = fields.Many2many(
|
||||
string="Taxes",
|
||||
|
||||
@@ -47,6 +47,7 @@ class PmsServiceLine(models.Model):
|
||||
store=True,
|
||||
comodel_name="pms.property",
|
||||
related="service_id.pms_property_id",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
date = fields.Date(
|
||||
string="Date",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="inherit_id" ref="account.view_bank_statement_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='company_id']" position="after">
|
||||
<field name="property_id" />
|
||||
<field name="pms_property_id" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -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