[IMP] pms: added button in reservation to print checkin report and formatted the report

This commit is contained in:
Sara Lago
2021-06-17 12:02:42 +02:00
parent 12aa3ddb31
commit 2d9488a18a
4 changed files with 185 additions and 63 deletions

View File

@@ -1299,6 +1299,16 @@ class PmsReservation(models.Model):
raise ValidationError(_("booking agency with wrong configuration: "))
# 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):
action = self.env.ref("pms.open_pms_folio1_form_tree_all").sudo().read()[0]

View File

@@ -59,19 +59,17 @@
<field name="reservation_id" />
<field name="folio_id" />
<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" />
</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>
</form>
</field>

View File

@@ -108,6 +108,15 @@
name="button_box"
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
name="preview_reservation"
type="object"

View File

@@ -2,10 +2,11 @@
<odoo>
<template id="report_viajero">
<t t-call="web.basic_layout">
<t t-foreach="docs" t-as="docs">
<img
t-attf-src="data:image/*;base64,{{docs.pms_property_id.company_id.logo}}"
t-att-alt="docs.pms_property_id.company_id.name"
/>
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>/
@@ -14,69 +15,51 @@
<p>
Total amount (Reservation Card):
<strong><span
t-field="docs.reservation_id.folio_id.amount_total"
/></strong>
t-field="docs.reservation_id.folio_id.amount_total"
/></strong>
</p>
<div>
<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 />
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><br
/></div>
<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>
<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>
<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>
<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>
<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>
<td>Lastnames</td>
<td><strong><span t-field="docs.lastname" /><span
t-field="docs.lastname2"
/></strong></td>
</tr>
</table>
<table>
@@ -115,26 +98,133 @@
</tr>
</table>
<div>
<p>
<p class="date">
<span t-field="docs.pms_property_id.partner_id.city" />, at
<span
t-esc="time.strftime('%Y-%m-%d')"
t-options="{&quot;widget&quot;: &quot;date&quot;}"
/>
t-esc="time.strftime('%Y-%m-%d')"
t-options="{&quot;widget&quot;: &quot;date&quot;}"
/>
</p>
<div
class="firma"
style="width: 85%; border:dotted 1px; height: 80px; margin:0 auto;"
/><br />
<div class="firma" /><br />
<p>Traveler's signature</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>
<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="{&quot;widget&quot;: &quot;date&quot;}"
/>
</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>
table{
width: 100%;
border: 1;
border-style: double;
margin-top:8px;
}
td:first-child{
width:40%;
@@ -148,7 +238,22 @@
border:double;
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>
</t>
</t>
</template>
</odoo>