[IMP] Pms: Add Customer Preview Button in reservation and folio

This commit is contained in:
Sara Lago
2021-03-18 13:31:54 +01:00
parent 2727d9fb22
commit f68f8a4cc4
4 changed files with 38 additions and 0 deletions

View File

@@ -547,6 +547,14 @@ class PmsFolio(models.Model):
for folio in self:
folio.access_url = "/my/folios/%s" % (folio.id)
def preview_folio(self):
self.ensure_one()
return {
"type": "ir.actions.act_url",
"target": "self",
"url": self.get_portal_url(),
}
def _search_invoice_ids(self, operator, value):
if operator == "in" and value:
self.env.cr.execute(

View File

@@ -845,6 +845,14 @@ class PmsReservation(models.Model):
for reservation in self:
reservation.access_url = "/my/reservations/%s" % (reservation.id)
def preview_reservation(self):
self.ensure_one()
return {
"type": "ir.actions.act_url",
"target": "self",
"url": self.get_portal_url(),
}
def _search_left_for_checkin(self, operator, value):
if operator not in ("=",):
raise UserError(

View File

@@ -41,6 +41,17 @@
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button
name="preview_folio"
type="object"
class="oe_stat_button"
icon="fa-globe icon"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Customer</span>
<span class="o_stat_text">Preview</span>
</div>
</button>
<button
type="object"
class="oe_stat_button"

View File

@@ -88,6 +88,17 @@
name="button_box"
attrs="{'invisible': [('folio_id','=',False)]}"
>
<button
name="preview_reservation"
type="object"
class="oe_stat_button"
icon="fa-globe icon"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Customer</span>
<span class="o_stat_text">Preview</span>
</div>
</button>
<button
type="object"
class="oe_stat_button"