[IMP] pos_pms_link:

- Adds checkin and checkout to reservation list.
- Improves reservation form format.
- Shows reservation name on order receipt
This commit is contained in:
Vicente
2023-03-27 18:03:09 +02:00
committed by Darío Lodeiros
parent 4f8bed8489
commit 064c1f96ef
8 changed files with 71 additions and 12 deletions

View File

@@ -43,6 +43,7 @@
"static/src/xml/Screens/ReservationListScreen/ReservationLine.xml",
"static/src/xml/Screens/ReservationListScreen/ReservationListScreen.xml",
"static/src/xml/Screens/PaymentScreen/PaymentScreen.xml",
"static/src/xml/Screens/ReceiptScreen/OrderReceipt.xml",
],
"installable": True,
}

View File

@@ -0,0 +1,21 @@
odoo.define('pos_pms_link.OrderReceipt', function (require) {
'use strict';
const OrderReceipt = require('point_of_sale.OrderReceipt');
const Registries = require('point_of_sale.Registries');
const session = require('web.session');
const PosPMSLinkOrderReceipt = (OrderReceipt) =>
class extends OrderReceipt {
get paid_on_reservation() {
return this.receiptEnv.receipt.paid_on_reservation;
}
get reservation_name() {
return this.env.pos.db.get_reservation_by_id(this.receiptEnv.receipt.pms_reservation_id).partner_name || "";
}
};
Registries.Component.extend(OrderReceipt, PosPMSLinkOrderReceipt);
return OrderReceipt;
});

View File

@@ -157,6 +157,13 @@ odoo.define('pos_pms_link.models', function (require) {
}
},
export_for_printing: function () {
let result = _super_order.export_for_printing.apply(this, arguments);
result.paid_on_reservation = this.paid_on_reservation;
result.pms_reservation_id = this.pms_reservation_id;
return result;
},
})
var _super_orderline = models.Orderline.prototype;
@@ -276,7 +283,7 @@ odoo.define('pos_pms_link.models', function (require) {
models.load_models({
model: 'pms.reservation',
fields: ['name', 'id', 'state', 'service_ids', 'partner_name', 'adults', 'children'],
fields: ['name', 'id', 'state', 'service_ids', 'partner_name', 'adults', 'children', 'checkin', 'checkout', 'folio_internal_comment'],
context: function(self){
var ctx_copy = session.user_context
ctx_copy['pos_user_force'] = true;
@@ -284,7 +291,7 @@ odoo.define('pos_pms_link.models', function (require) {
},
domain: function(self){
var domain = [
['state', '!=', 'cancel']
['state', '=', 'onboard']
];
if (self.config_id && self.config.reservation_allowed_propertie_ids) domain.push(['pms_property_id', 'in', self.config.reservation_allowed_propertie_ids]);
return domain;

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-name="OrderReceipt" t-inherit="point_of_sale.OrderReceipt" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('before-footer')]" position="before">
<t t-if="paid_on_reservation">
<br/><br/>
<div>
Signature: <br/><br/>
<span t-esc="reservation_name" style="font-size: 100%;"/><br/>
-------------------
</div>
</t>
</xpath>
</t>
</templates>

View File

@@ -5,13 +5,17 @@
<section class="client-details edit">
<h3 class="detail client-name" t-esc="props.reservation.name"/>
<div class="client-details-box clearfix">
<div class="client-details-left">
<span class="detail client-partner-name" t-esc="props.reservation.partner_name"/><br/>
<span class="detail client-aduls" t-esc="props.reservation.adults"/><br/>
<span class="detail client-children" t-esc="props.reservation.children"/><br/>
<div class="client-details-row">
Name: <span class="detail client-partner-name" t-esc="props.reservation.partner_name"/><br/>
Checkin: <span class="detail client-aduls" t-esc="props.reservation.checkin"/><br/>
Checkout: <span class="detail client-aduls" t-esc="props.reservation.checkout"/><br/>
Adults: <span class="detail client-aduls" t-esc="props.reservation.adults"/><br/>
Children: <span class="detail client-children" t-esc="props.reservation.children"/><br/>
Internal comment: <span class="detail client-aduls" t-esc="props.reservation.folio_internal_comment"/><br/>
</div>
<div class="client-details-right">
<table>
<h3 class="detail client-name">Services:</h3>
<div class="client-details-row">
<table class="content-row">
<thead>
<tr>
<th>Service</th>
@@ -19,8 +23,8 @@
</tr>
</thead>
<tbody>
<tr>
<t t-foreach="props.reservation.service_ids" t-as="service" t-key="service.id">
<t t-foreach="props.reservation.service_ids" t-as="service" t-key="service.id">
<tr>
<td t-esc="service_value['name']"/>
<td>
<ul>
@@ -31,8 +35,8 @@
</t>
</ul>
</td>
</t>
</tr>
</tr>
</t>
</tbody>
</table>
</div>

View File

@@ -13,6 +13,12 @@
<td>
<t t-esc="props.reservation.partner_name" />
</td>
<td>
<t t-esc="props.reservation.checkin" />
</td>
<td>
<t t-esc="props.reservation.checkout" />
</td>
<td>
<t t-esc="props.reservation.adults" />
</td>

View File

@@ -43,6 +43,8 @@
<tr>
<th>Name</th>
<th>Partner name</th>
<th>Checkin</th>
<th>Checkout</th>
<th>Adults</th>
<th>Children</th>
</tr>

View File

@@ -10,6 +10,7 @@
<script type="text/javascript" src="/pos_pms_link/static/src/js/Screens/ReservationListScreen/ReservationLine.js"></script>
<script type="text/javascript" src="/pos_pms_link/static/src/js/Screens/ReservationListScreen/ReservationListScreen.js"></script>
<script type="text/javascript" src="/pos_pms_link/static/src/js/Screens/PaymentScreen/PaymentScreen.js"></script>
<script type="text/javascript" src="/pos_pms_link/static/src/js/Screens/ReceiptScreen/OrderReceipt.js"></script>
</xpath>
</template>