mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] pms: added button in reservation to print checkin report and formatted the report
This commit is contained in:
@@ -1299,6 +1299,16 @@ class PmsReservation(models.Model):
|
|||||||
raise ValidationError(_("booking agency with wrong configuration: "))
|
raise ValidationError(_("booking agency with wrong configuration: "))
|
||||||
|
|
||||||
# Action methods
|
# Action methods
|
||||||
|
def print_all_checkins(self):
|
||||||
|
checkins = self.env["pms.checkin.partner"]
|
||||||
|
for record in self:
|
||||||
|
checkins += record.checkin_partner_ids.filtered(
|
||||||
|
lambda s: s.state in ("onboard", "done")
|
||||||
|
)
|
||||||
|
if checkins:
|
||||||
|
return self.env.ref("pms.action_report_viajero").report_action(checkins)
|
||||||
|
else:
|
||||||
|
raise ValidationError(_("Some checkin partners "))
|
||||||
|
|
||||||
def open_folio(self):
|
def open_folio(self):
|
||||||
action = self.env.ref("pms.open_pms_folio1_form_tree_all").sudo().read()[0]
|
action = self.env.ref("pms.open_pms_folio1_form_tree_all").sudo().read()[0]
|
||||||
|
|||||||
@@ -59,19 +59,17 @@
|
|||||||
<field name="reservation_id" />
|
<field name="reservation_id" />
|
||||||
<field name="folio_id" />
|
<field name="folio_id" />
|
||||||
<field name="identifier" />
|
<field name="identifier" />
|
||||||
<button
|
|
||||||
type="action"
|
|
||||||
class="oe_stat_button"
|
|
||||||
icon="fa-file-pdf-o"
|
|
||||||
name="%(action_report_viajero)d"
|
|
||||||
context="{'partner_id': partner_id,'enter_date': arrival,
|
|
||||||
'exit_date': departure,'reservation_ids': reservation_id,
|
|
||||||
'hidden_cardex': True, 'edit_cardex': True }"
|
|
||||||
string="Print in PDF"
|
|
||||||
/>
|
|
||||||
<field name="pms_property_id" invisible="1" />
|
<field name="pms_property_id" invisible="1" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
<button
|
||||||
|
type="action"
|
||||||
|
class="btn-primary float-right"
|
||||||
|
icon="fa-file-pdf-o"
|
||||||
|
name="%(action_report_viajero)d"
|
||||||
|
string="Print in PDF"
|
||||||
|
attrs="{'invisible': [('state','not in', ('onboard','done'))]}"
|
||||||
|
/>
|
||||||
</sheet>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -108,6 +108,15 @@
|
|||||||
name="button_box"
|
name="button_box"
|
||||||
attrs="{'invisible': [('folio_id','=',False)]}"
|
attrs="{'invisible': [('folio_id','=',False)]}"
|
||||||
>
|
>
|
||||||
|
<button
|
||||||
|
name="print_all_checkins"
|
||||||
|
string="Print All Checkins"
|
||||||
|
type="object"
|
||||||
|
icon="fa-print"
|
||||||
|
attrs="{'invisible':[
|
||||||
|
('checkin_partner_ids','=', [])
|
||||||
|
]}"
|
||||||
|
/>
|
||||||
<button
|
<button
|
||||||
name="preview_reservation"
|
name="preview_reservation"
|
||||||
type="object"
|
type="object"
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
<odoo>
|
<odoo>
|
||||||
<template id="report_viajero">
|
<template id="report_viajero">
|
||||||
<t t-call="web.basic_layout">
|
<t t-call="web.basic_layout">
|
||||||
|
<t t-foreach="docs" t-as="docs">
|
||||||
<img
|
<img
|
||||||
t-attf-src="data:image/*;base64,{{docs.pms_property_id.company_id.logo}}"
|
t-attf-src="data:image/*;base64,{{docs.pms_property_id.company_id.logo}}"
|
||||||
t-att-alt="docs.pms_property_id.company_id.name"
|
t-att-alt="docs.pms_property_id.company_id.name"
|
||||||
/>
|
/>
|
||||||
<p>PART OF TRAVELERS ENTRY</p>
|
<p>PART OF TRAVELERS ENTRY</p>
|
||||||
<p>Document number:
|
<p>Document number:
|
||||||
<strong><span t-field="docs.id" /></strong>/
|
<strong><span t-field="docs.id" /></strong>/
|
||||||
@@ -14,69 +15,51 @@
|
|||||||
<p>
|
<p>
|
||||||
Total amount (Reservation Card):
|
Total amount (Reservation Card):
|
||||||
<strong><span
|
<strong><span
|
||||||
t-field="docs.reservation_id.folio_id.amount_total"
|
t-field="docs.reservation_id.folio_id.amount_total"
|
||||||
/></strong>
|
/></strong>
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div class="property">
|
||||||
<strong><span t-field="docs.pms_property_id.name" /></strong><br />
|
<strong><span t-field="docs.pms_property_id.name" /></strong><br />
|
||||||
<strong>CIF:
|
<strong>CIF:
|
||||||
<span t-field="docs.pms_property_id.company_id.vat" /></strong><br
|
<span t-field="docs.pms_property_id.company_id.vat" /></strong><br
|
||||||
/>
|
/>
|
||||||
<span t-field="docs.pms_property_id.company_id.name" /><br />
|
<span t-field="docs.pms_property_id.company_id.name" /><br />
|
||||||
<strong><span t-field="docs.pms_property_id.company_id.street" />
|
<strong><span t-field="docs.pms_property_id.company_id.street" />
|
||||||
<span
|
<span
|
||||||
t-field="docs.pms_property_id.company_id.street2"
|
t-field="docs.pms_property_id.company_id.street2"
|
||||||
/></strong><br />
|
/></strong><br />
|
||||||
<strong><span t-field="docs.pms_property_id.company_id.zip" />
|
<strong><span t-field="docs.pms_property_id.company_id.zip" />
|
||||||
<span t-field="docs.pms_property_id.company_id.city" /></strong><br
|
<span t-field="docs.pms_property_id.company_id.city" /></strong><b
|
||||||
/></div>
|
/>
|
||||||
|
</div>
|
||||||
<p>TRAVELER'S DOCUMENT</p>
|
<p>TRAVELER'S DOCUMENT</p>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>Document number</td>
|
||||||
Document number</td>
|
<td><strong><span t-field="docs.document_number" /></strong></td>
|
||||||
<td>
|
|
||||||
<strong>
|
|
||||||
<span t-field="docs.document_number" /></strong>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>Type</td>
|
||||||
Type
|
<td><strong><span t-field="docs.document_type" /></strong></td>
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<strong>
|
|
||||||
<span t-field="docs.document_type" />
|
|
||||||
</strong>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>Expedition date</td>
|
||||||
Expedition date</td>
|
<td><strong><span
|
||||||
<td>
|
t-field="docs.document_expedition_date"
|
||||||
<strong>
|
/></strong></td>
|
||||||
<span t-field="docs.document_expedition_date" /></strong>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>Name</td>
|
||||||
Name</td>
|
<td><strong> <span t-field="docs.firstname" /></strong></td>
|
||||||
<td>
|
|
||||||
<strong>
|
|
||||||
<span t-field="docs.firstname" /></strong>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>Lastnames</td>
|
||||||
Lastnames</td>
|
<td><strong><span t-field="docs.lastname" /><span
|
||||||
<td>
|
t-field="docs.lastname2"
|
||||||
<strong>
|
/></strong></td>
|
||||||
<span t-field="docs.lastname" />
|
|
||||||
<span t-field="docs.lastname2" />
|
|
||||||
</strong>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
@@ -115,26 +98,133 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p class="date">
|
||||||
<span t-field="docs.pms_property_id.partner_id.city" />, at
|
<span t-field="docs.pms_property_id.partner_id.city" />, at
|
||||||
<span
|
<span
|
||||||
t-esc="time.strftime('%Y-%m-%d')"
|
t-esc="time.strftime('%Y-%m-%d')"
|
||||||
t-options="{"widget": "date"}"
|
t-options="{"widget": "date"}"
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
<div
|
<div class="firma" /><br />
|
||||||
class="firma"
|
|
||||||
style="width: 85%; border:dotted 1px; height: 80px; margin:0 auto;"
|
|
||||||
/><br />
|
|
||||||
<p>Traveler's signature</p>
|
<p>Traveler's signature</p>
|
||||||
<p><span t-field="docs.pms_property_id.cardex_warning" /></p>
|
<p><span t-field="docs.pms_property_id.cardex_warning" /></p>
|
||||||
<p><span t-field="docs.pms_property_id.company_id.privacy_policy" /></p>
|
<p><span t-field="docs.pms_property_id.company_id.privacy_policy" /></p>
|
||||||
</div>
|
</div>
|
||||||
|
<p style="page-break-after:always;" />
|
||||||
|
<img
|
||||||
|
t-attf-src="data:image/*;base64,{{docs.pms_property_id.company_id.logo}}"
|
||||||
|
t-att-alt="docs.pms_property_id.company_id.name"
|
||||||
|
/>
|
||||||
|
<p>PART OF TRAVELERS ENTRY</p>
|
||||||
|
<p>Document number:
|
||||||
|
<strong><span t-field="docs.id" /></strong>/
|
||||||
|
<span t-field="docs.reservation_id" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Total amount (Reservation Card):
|
||||||
|
<strong><span
|
||||||
|
t-field="docs.reservation_id.folio_id.amount_total"
|
||||||
|
/></strong>
|
||||||
|
</p>
|
||||||
|
<div class="property">
|
||||||
|
<strong><span t-field="docs.pms_property_id.name" /></strong><br />
|
||||||
|
<strong>CIF:
|
||||||
|
<span t-field="docs.pms_property_id.company_id.vat" /></strong><br
|
||||||
|
/>
|
||||||
|
<span t-field="docs.pms_property_id.company_id.name" /><br />
|
||||||
|
<strong><span t-field="docs.pms_property_id.company_id.street" />
|
||||||
|
<span
|
||||||
|
t-field="docs.pms_property_id.company_id.street2"
|
||||||
|
/></strong><br />
|
||||||
|
<strong><span t-field="docs.pms_property_id.company_id.zip" />
|
||||||
|
<span t-field="docs.pms_property_id.company_id.city" /></strong><b
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p>TRAVELER'S DOCUMENT</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Document number</td>
|
||||||
|
<td><strong><span t-field="docs.document_number" /></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Type</td>
|
||||||
|
<td><strong><span t-field="docs.document_type" /></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Expedition date</td>
|
||||||
|
<td><strong><span
|
||||||
|
t-field="docs.document_expedition_date"
|
||||||
|
/></strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>Name</td>
|
||||||
|
<td><strong> <span t-field="docs.firstname" /></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Lastnames</td>
|
||||||
|
<td><strong><span t-field="docs.lastname" /><span
|
||||||
|
t-field="docs.lastname2"
|
||||||
|
/></strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Gender</td>
|
||||||
|
<td>
|
||||||
|
<strong>
|
||||||
|
<span t-field="docs.gender" /></strong>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Birthdate</td>
|
||||||
|
<td>
|
||||||
|
<strong>
|
||||||
|
<span t-field="docs.birthdate_date" /></strong>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Entry date</td>
|
||||||
|
<td>
|
||||||
|
<strong>
|
||||||
|
<span t-field="docs.arrival" /></strong>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Exit date</td>
|
||||||
|
<td>
|
||||||
|
<strong><span t-field="docs.departure" /></strong>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div>
|
||||||
|
<p class="date">
|
||||||
|
<span t-field="docs.pms_property_id.partner_id.city" />, at
|
||||||
|
<span
|
||||||
|
t-esc="time.strftime('%Y-%m-%d')"
|
||||||
|
t-options="{"widget": "date"}"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
<p><strong>Copy for the host</strong></p>
|
||||||
|
<p><span t-field="docs.pms_property_id.cardex_warning" /></p>
|
||||||
|
<p><span t-field="docs.pms_property_id.company_id.privacy_policy" /></p>
|
||||||
|
</div>
|
||||||
|
<div class="final" />
|
||||||
|
<p style="page-break-after:always;" />
|
||||||
<style>
|
<style>
|
||||||
table{
|
table{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 1;
|
border: 1;
|
||||||
border-style: double;
|
border-style: double;
|
||||||
|
margin-top:8px;
|
||||||
}
|
}
|
||||||
td:first-child{
|
td:first-child{
|
||||||
width:40%;
|
width:40%;
|
||||||
@@ -148,7 +238,22 @@
|
|||||||
border:double;
|
border:double;
|
||||||
border-width:1px;
|
border-width:1px;
|
||||||
}
|
}
|
||||||
|
.firma{
|
||||||
|
width: 85%;
|
||||||
|
border:dotted 1px;
|
||||||
|
height: 80px;
|
||||||
|
margin:0 auto;
|
||||||
|
}
|
||||||
|
p,.property{
|
||||||
|
text-align: center;
|
||||||
|
font-family: kiro, Verdana, Geneva, sans-serif;
|
||||||
|
}
|
||||||
|
.date{
|
||||||
|
margin-top:8px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user