mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD]pms: Button Booking Engine tree reservation
This commit is contained in:
41
pms/static/src/js/pms_list_controller.js
Normal file
41
pms/static/src/js/pms_list_controller.js
Normal file
@@ -0,0 +1,41 @@
|
||||
odoo.define("booking.engine.tree", function (require) {
|
||||
"use strict";
|
||||
var ListController = require("web.ListController");
|
||||
var ListView = require("web.ListView");
|
||||
var viewRegistry = require("web.view_registry");
|
||||
|
||||
function renderBookingEngineButton() {
|
||||
if (this.$buttons) {
|
||||
var self = this;
|
||||
this.$buttons.on("click", ".o_button_booking_engine", function () {
|
||||
self.do_action({
|
||||
name: "Booking Engine",
|
||||
type: "ir.actions.act_window",
|
||||
res_model: "pms.folio.wizard",
|
||||
target: "new",
|
||||
views: [[false, "form"]],
|
||||
context: {is_modal: true},
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var BookingEngineRequestListController = ListController.extend({
|
||||
start: function () {
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
buttons_template: "BookingEngineRequestListView.buttons",
|
||||
renderButtons: function () {
|
||||
this._super.apply(this, arguments);
|
||||
renderBookingEngineButton.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
|
||||
var BookingEngineRequestListView = ListView.extend({
|
||||
config: _.extend({}, ListView.prototype.config, {
|
||||
Controller: BookingEngineRequestListController,
|
||||
}),
|
||||
});
|
||||
|
||||
viewRegistry.add("pms_booking_engine_request_tree", BookingEngineRequestListView);
|
||||
});
|
||||
@@ -1,54 +0,0 @@
|
||||
odoo.define("pms.group.reservation.wizard", function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require("web.core");
|
||||
var _t = core._t;
|
||||
|
||||
var qweb = core.qweb;
|
||||
|
||||
var ReservationWizard = {
|
||||
start: function () {
|
||||
// Define a unique uploadId and a callback method
|
||||
// this.fileUploadID = _.uniqueId("account_bill_file_upload");
|
||||
// $(window).on(this.fileUploadID, this._onFileUploaded.bind(this));
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
_onNewReservationGroup: function (event) {
|
||||
var self = this;
|
||||
|
||||
return this.do_action("pms.action_wizard_folio", {
|
||||
on_close: function () {
|
||||
self.reload();
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
return ReservationWizard;
|
||||
});
|
||||
|
||||
odoo.define("pms.reservation.group", function (require) {
|
||||
"use strict";
|
||||
var core = require("web.core");
|
||||
var ListController = require("web.ListController");
|
||||
var ListView = require("web.ListView");
|
||||
var viewRegistry = require("web.view_registry");
|
||||
|
||||
var ReservationGroupRequestListController = ListController.extend(
|
||||
ReservationWizard,
|
||||
{
|
||||
buttons_template: "ReservationGroupList.buttons",
|
||||
events: _.extend({}, ListController.prototype.events, {
|
||||
"click .o_button_wizard_resevation": "_onNewReservationGroup",
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
var ReservationGroupRequestListView = ListView.extend({
|
||||
config: _.extend({}, ListView.prototype.config, {
|
||||
Controller: ReservationGroupRequestListController,
|
||||
}),
|
||||
});
|
||||
|
||||
viewRegistry.add("reservation_group", ReservationGroupRequestListView);
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates>
|
||||
<t t-extend="ListView.buttons" t-name="ReservationGroupList.buttons">
|
||||
<t t-extend="ListView.buttons" t-name="BookingEngineRequestListView.buttons">
|
||||
<t t-jquery="button.o_list_button_add" t-operation="after">
|
||||
<button type="button" class="btn btn-secondary o_button_wizard_resevation">
|
||||
<button type="button" class="btn btn-primary o_button_booking_engine">
|
||||
Booking Engine
|
||||
</button>
|
||||
</t>
|
||||
|
||||
Reference in New Issue
Block a user