mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: added is_reselling field in reservation lines and reservation models
This commit is contained in:
@@ -716,6 +716,14 @@ class PmsReservation(models.Model):
|
||||
default=False,
|
||||
)
|
||||
|
||||
is_reselling = fields.Boolean(
|
||||
string="Reselling",
|
||||
help="Indicate if exists reselling in any reservation line",
|
||||
compute="_compute_is_reselling",
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
|
||||
@api.depends("folio_id", "folio_id.external_reference")
|
||||
def _compute_external_reference(self):
|
||||
for reservation in self:
|
||||
@@ -964,7 +972,7 @@ class PmsReservation(models.Model):
|
||||
|
||||
@api.depends("board_service_room_id")
|
||||
def _compute_service_ids(self):
|
||||
if self.env.context.get('skip_compute_service_ids', False):
|
||||
if self.env.context.get("skip_compute_service_ids", False):
|
||||
return
|
||||
for reservation in self:
|
||||
board_services = []
|
||||
@@ -1662,6 +1670,14 @@ class PmsReservation(models.Model):
|
||||
for record in self:
|
||||
record.force_update_origin = True
|
||||
|
||||
@api.depends("is_reselling")
|
||||
def _compute_is_reselling(self):
|
||||
for record in self:
|
||||
if any(record.reservation_line_ids.mapped("is_reselling")):
|
||||
record.is_reselling = True
|
||||
else:
|
||||
record.is_reselling = False
|
||||
|
||||
def _search_allowed_checkin(self, operator, value):
|
||||
if operator not in ("=",):
|
||||
raise UserError(
|
||||
|
||||
@@ -136,6 +136,13 @@ class PmsReservationLine(models.Model):
|
||||
ondelete="restrict",
|
||||
)
|
||||
|
||||
is_reselling = fields.Boolean(
|
||||
string="Reselling",
|
||||
help="Indicates if the reservation line is reselling",
|
||||
readonly=False,
|
||||
store=True,
|
||||
)
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for res in self:
|
||||
@@ -391,10 +398,14 @@ class PmsReservationLine(models.Model):
|
||||
)
|
||||
# TODO: Out of service 0 amount
|
||||
|
||||
@api.depends("reservation_id.state", "reservation_id.overbooking")
|
||||
@api.depends("reservation_id.state", "reservation_id.overbooking", "is_reselling")
|
||||
def _compute_occupies_availability(self):
|
||||
for line in self:
|
||||
if line.reservation_id.state == "cancel" or line.reservation_id.overbooking:
|
||||
if (
|
||||
line.reservation_id.state == "cancel"
|
||||
or line.reservation_id.overbooking
|
||||
or line.is_reselling
|
||||
):
|
||||
line.occupies_availability = False
|
||||
else:
|
||||
line.occupies_availability = True
|
||||
|
||||
@@ -302,6 +302,14 @@
|
||||
<i class="fa fa-warning" /> OverBooking
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="card bg-info mb8"
|
||||
attrs="{'invisible': [('is_reselling', '=', False)]}"
|
||||
>
|
||||
<div class="card-body bg-info">
|
||||
<i class="fa fa-warning" /> Reselling
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="oe_right">
|
||||
<field
|
||||
name="pms_property_id"
|
||||
@@ -458,6 +466,7 @@
|
||||
/>
|
||||
<field placeholder="Arrival Hour" name="arrival_hour" />
|
||||
<field placeholder="Departure Hour" name="departure_hour" />
|
||||
<field name="is_reselling" invisible="1" />
|
||||
</group>
|
||||
<div class="oe_clear" />
|
||||
</group>
|
||||
@@ -494,6 +503,10 @@
|
||||
<field name="cancel_discount" invisible="1" />
|
||||
<field name="sale_channel_id" />
|
||||
<field name="default_invoice_to" />
|
||||
<field
|
||||
name="is_reselling"
|
||||
attrs="{'column_invisible': [('parent.is_reselling','=', False)]}"
|
||||
/>
|
||||
<field name="pms_property_id" invisible="1" />
|
||||
</tree>
|
||||
</field>
|
||||
@@ -765,6 +778,7 @@
|
||||
sample="1"
|
||||
class="o_sale_order"
|
||||
decoration-warning="splitted"
|
||||
decoration-muted="is_reselling"
|
||||
js_class="pms_booking_engine_request_tree"
|
||||
>
|
||||
<field name="reservation_type" invisible="1" />
|
||||
@@ -776,6 +790,7 @@
|
||||
decoration-bf="reservation_type == 'out'"
|
||||
/>
|
||||
<field name="splitted" invisible="1" />
|
||||
<field name="is_reselling" invisible="1" />
|
||||
<field name="pricelist_id" invisible="1" />
|
||||
<field name="rooms" />
|
||||
<field name="checkin" />
|
||||
|
||||
Reference in New Issue
Block a user