[IMP] pos_pms_link:

- Add translation.
- Add improved search.
- Add note to pos.order.line with reservation and room.
- Add room to list.
- Add new domain.
- Add reservation confirm popup.
- Add hides reservation payment button if there is payment lines in the order.
This commit is contained in:
Vicente
2023-05-02 12:06:41 +02:00
committed by Darío Lodeiros
parent a3821a403f
commit 63ac94574f
7 changed files with 397 additions and 14 deletions

View File

@@ -15,17 +15,25 @@ odoo.define('pos_pms_link.PaymentScreen', function (require) {
if (confirmed) {
var self = this;
var payment_method = {
'id': self.env.pos.config.pay_on_reservation_method_id[0],
'name': self.env.pos.config.pay_on_reservation_method_id[1],
'is_cash_count': false,
'pos_mercury_config_id': false,
'use_payment_terminal': false,
const { confirmed } = await this.showPopup('ConfirmPopup', {
title: this.env._t('Pay order with reservation ?'),
body: this.env._t(
'This operation will add all the products in the order to the reservation. RESERVATION: ' + newReservation['name'] + ' PARTNER : ' + newReservation['partner_name'] + ' ROOM: ' + newReservation['rooms']
),
});
if (confirmed) {
var payment_method = {
'id': self.env.pos.config.pay_on_reservation_method_id[0],
'name': self.env.pos.config.pay_on_reservation_method_id[1],
'is_cash_count': false,
'pos_mercury_config_id': false,
'use_payment_terminal': false,
}
self.trigger('new-payment-line', payment_method);
this.currentOrder.set_paid_on_reservation(true);
this.currentOrder.set_pms_reservation_id(newReservation['id']);
self.validateOrder(false);
}
self.trigger('new-payment-line', payment_method);
this.currentOrder.set_paid_on_reservation(true);
this.currentOrder.set_pms_reservation_id(newReservation['id']);
self.validateOrder(false);
}
}
};

View File

@@ -67,7 +67,9 @@ odoo.define("pos_pms_link.db", function (require) {
},
_reservation_search_string: function(reservation){
var str = reservation.name || '';
str = '' + reservation.id + ':' + str.replace(':', '').replace(/\n/g, ' ') + '\n';
var room_str = reservation.rooms || '';
var partner_str = reservation.partner_name || '';
str = '' + reservation.id + ':' + str.replace(':', '').replace(/\n/g, ' ') + ':' + room_str.replace(':', '').replace(/\n/g, ' ') + ':' + partner_str.replace(':', '').replace(/\n/g, ' ') + '\n';
return str;
},
add_reservations: function(reservations){

View File

@@ -117,6 +117,8 @@ odoo.define('pos_pms_link.models', function (require) {
};
var service_product = self.pos.db.get_product_by_id(service_line_id.product_id[0]);
self.pos.get_order().add_product(service_product, options);
var last_line = self.pos.get_order().get_last_orderline();
last_line.set_note("RESERVATION: " + reservation.name + " ROOMS: " + reservation.rooms);
var r_service_line_id = reservation.service_ids.map(x => x.service_line_ids)[0].find(x=>x.id==service_line_id.id);
if (r_service_line_id.pos_order_line_ids.length == 0) {
r_service_line_id.pos_order_line_ids.push({
@@ -283,15 +285,27 @@ odoo.define('pos_pms_link.models', function (require) {
models.load_models({
model: 'pms.reservation',
fields: ['name', 'id', 'state', 'service_ids', 'partner_name', 'adults', 'children', 'checkin', 'checkout', 'folio_internal_comment'],
fields: ['name', 'id', 'state', 'service_ids', 'partner_name', 'adults', 'children', 'checkin', 'checkout', 'folio_internal_comment', 'rooms'],
context: function(self){
var ctx_copy = session.user_context
ctx_copy['pos_user_force'] = true;
return ctx_copy;
},
domain: function(self){
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
var current_date = d.getFullYear() + '-' +
(month<10 ? '0' : '') + month + '-' +
(day<10 ? '0' : '') + day;
var domain = [
['state', '=', 'onboard']
'|',
'&',
['state', '=', 'onboard'],
['checkout', '=', current_date],
['state', '!=', 'cancel']
];
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

@@ -4,7 +4,7 @@
<t t-name="pos_pms_link.PaymentScreen" t-inherit="point_of_sale.PaymentScreen" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('paymentmethods')]" position="inside">
<div class="button paymentmethod">
<div class="payment-name" t-if="env.pos.config.pay_on_reservation" t-on-click="selectReservation">Reservation</div>
<div class="payment-name" t-if="env.pos.config.pay_on_reservation and currentOrder.paymentlines.length == 0" t-on-click="selectReservation">Reservation</div>
</div>
</xpath>
</t>

View File

@@ -13,6 +13,9 @@
<td>
<t t-esc="props.reservation.partner_name" />
</td>
<td>
<t t-esc="props.reservation.rooms" />
</td>
<td>
<t t-esc="props.reservation.checkin" />
</td>

View File

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