Views Configuration En
Project Views Configuration
Apart from the generic list and report views for projects and tasks, ERPNext also provides Gantt, Kanban, and Calendar views for tasks. You can access these views by going to the Task list and selecting them via the right sidebar.
Kanban Button
In ERPNext there is a Kanban view that have a different way to show the tasks of some project.
We can go to the Kanban View using the View button in the upper right corner of the Project doctype.
But what if we want the button that move us to the Kanban View on the spot.
To do the Kanban Button we need to:
-
Go to the Client Script doctype
-
Press the Add Client Script button
-
Name your script
-
Select the doctype where this button will be located (In our case it’s ‘Project’)
-
In the Script form write down this code:
- We use frappe.ui.form.on to indicate the Doctype where the client script will work
- We use frm.add_custom_button to give a name the button and indicate the function that will work after the button is pressed
- in the frappe.call we reffer to the create_kanban_board_if_not_exists that creates the Kanban Board attached to current project if board do not exists yet
- frappe.set_route function is used for redirecting to a new route (in our case it’s ‘List’, ‘Task’, ‘Kanban’, frm.doc.project_name - returns the current project name)
-
Turn on the Enabled option
-
Press the Save button
After this the button will appear in the Project doctype
This button will redirect us to the Kanban View filtered by project name
Calendar View for Doctype
In ERPNext some doctypes have a build in calendar view. You can set the calendar view in needed doctype by creating a configuration file in the Frappe file system. The configuration file should be named {doctype}_calendar.js and should exist in the doctype directory.
Here is an example configuration file for calendar view for Appraisal doctype, which must be set in the appraisal_calendar.js file.
- frappe.views.calendar provides functionality for displaying data in a calendar view
- field_map key is an optional configuration parameter that can be passed to the frappe.views.calendar module in order to specify how event data should be mapped to the fields in the calendar view
- start - specifies the field in the document that contains the start date and time of the event.
- end - specifies the field in the document that contains the end date and time of the event.
- id - specifies the field in the document that contains the unique ID of the event.
- title - specifies the field in the document that contains the title of the event.
After this go to the needed doctype and press the Customize option. In the Customize Form turn on the Is Calendar and Gantt option.
Now if you press the Views button in the doctype you’ll se the Calendar view.