我已经检查过该按钮是由 JavaScript 创建的。您只需要覆盖该方法。关注Odoo documentation guidelines。使用extend 或include 覆盖它
var CalendarView = View.extend({
// [...]
open_event: function(id, title) {
var self = this;
if (! this.open_popup_action) {
var index = this.dataset.get_id_index(id);
this.dataset.index = index;
if (this.write_right) {
this.do_switch_view('form', { mode: "edit" });
} else {
this.do_switch_view('form', { mode: "view" });
}
}
else {
new form_common.FormViewDialog(this, {
res_model: this.model,
res_id: parseInt(id).toString() === id ? parseInt(id) : id,
context: this.dataset.get_context(),
title: title,
view_id: +this.open_popup_action,
readonly: true,
buttons: [
{text: _t("Edit"), classes: 'btn-primary', close: true, click: function() {
self.dataset.index = self.dataset.get_id_index(id);
self.do_switch_view('form', { mode: "edit" });
}},
{text: _t("Delete"), close: true, click: function() {
self.remove_event(id);
}},
{text: _t("Close"), close: true}
]
}).open();
}
return false;
},
所以我认为如果你删除 these lines 就足够了:
{text: _t("Delete"), close: true, click: function() {
self.remove_event(id);
}},
顺便说一下,在最后一个链接中可以看到,要修改(通过继承)的文件是addons/web_calendar/static/src/js/web_calendar.js