odoo.define("hotel_reservation.hotel_room_summary", function (require) {
"use strict";
var core = require("web.core");
var registry = require("web.field_registry");
var basicFields = require("web.basic_fields");
var FieldText = basicFields.FieldText;
var QWeb = core.qweb;
var FormView = require("web.FormView");
var py = window.py;
var MyWidget = FieldText.extend({
events: _.extend({}, FieldText.prototype.events, {
change: "_onFieldChanged",
}),
init: function () {
this._super.apply(this, arguments);
if (this.mode === "edit") {
this.tagName = "span";
}
this.set({
date_to: false,
date_from: false,
summary_header: false,
room_summary: false,
});
this.set({
summary_header: py.eval(this.recordData.summary_header),
});
this.set({
room_summary: py.eval(this.recordData.room_summary),
});
},
start: function () {
var self = this;
if (self.setting) {
return;
}
if (!this.get("summary_header") || !this.get("room_summary")) {
return;
}
this.renderElement();
this.view_loading();
},
initialize_field: function () {
FormView.ReinitializeWidgetMixin.initialize_field.call(this);
var self = this;
self.on("change:summary_header", self, self.start);
self.on("change:room_summary", self, self.start);
},
view_loading: function (r) {
return this.load_form(r);
},
load_form: function () {
var self = this;
this.$el.find(".table_free").bind("click", function () {
self.do_action({
type: "ir.actions.act_window",
res_model: "quick.room.reservation",
views: [[false, "form"]],
target: "new",
context: {
room_id: $(this).attr("data"),
date: $(this).attr("date"),
default_adults: 1,
},
});
});
},
renderElement: function () {
this._super();
this.$el.html(
QWeb.render("RoomSummary", {
widget: this,
})
);
},
_onFieldChanged: function (event) {
this._super();
this.lastChangeEvent = event;
this.set({
summary_header: py.eval(this.recordData.summary_header),
});
this.set({
room_summary: py.eval(this.recordData.room_summary),
});
this.renderElement();
this.view_loading();
},
});
registry.add("Room_Reservation", MyWidget);
return MyWidget;
});
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- Müşteri İlişkileri Yönetimi
- e-Commerce
- Muhasebe
- Envanter
- PoS
- Project
- MRP
Bu soru işaretlendi
1393
Görünümler
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Üye Olİlgili Gönderiler | Cevaplar | Görünümler | Aktivite | |
---|---|---|---|---|
|
1
Eyl 19
|
2240 | ||
|
5
Ağu 25
|
1398 | ||
|
1
Şub 25
|
12360 | ||
|
0
Kas 24
|
1220 | ||
|
0
Eki 23
|
102 |