Add Show Calendar button
This commit is contained in:
parent
8c291c9b20
commit
1fbc8ff448
2 changed files with 12 additions and 1 deletions
|
|
@ -5,6 +5,12 @@ frappe.ui.form.on('Calendar View', {
|
|||
onload: function(frm) {
|
||||
frm.trigger('reference_doctype');
|
||||
},
|
||||
refresh: function(frm) {
|
||||
if (!frm.is_new()) {
|
||||
frm.add_custom_button(__('Show Calendar'),
|
||||
() => frappe.set_route('List', frm.doc.reference_doctype, 'Calendar', frm.doc.name))
|
||||
}
|
||||
},
|
||||
reference_doctype: function(frm) {
|
||||
const { reference_doctype } = frm.doc;
|
||||
if (!reference_doctype) return;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,12 @@ frappe.views.CalendarView = frappe.views.ListRenderer.extend({
|
|||
if(!should_refresh) {
|
||||
this.last_calendar_view = this.current_calendar_view || '';
|
||||
this.current_calendar_view = this.get_calendar_view();
|
||||
this.page_title = __(this.get_calendar_view());
|
||||
|
||||
if (this.current_calendar_view !== 'Default') {
|
||||
this.page_title = __(this.current_calendar_view);
|
||||
} else {
|
||||
this.page_title = this.doctype + ' ' + __('Calendar');
|
||||
}
|
||||
|
||||
should_refresh = this.current_calendar_view !== this.last_calendar_view;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue