frappe / frappe

Low code web framework for real world applications, in Python and Javascript
https://frappeframework.com
MIT License
7.02k stars 3.35k forks source link

ToDo Gantt erroneous behaviour #15582

Closed matt-scully closed 6 months ago

matt-scully commented 2 years ago

Firstly, I would like to thank everyone at the Frappe and ERPNext for developing such a fantastic product. Keep up the amazing work! βœ¨πŸ™πŸ½

Description of the issue

ERPNext's ToDo Gantt chart does not correctly: πŸ› Gantt Bar period/size not correct.
πŸ› Gantt Bar Title only renders when name data field is used. πŸ› Gant Bar not clickable

Context information (for bug reports)

Todo > View > Gantt incorrectly working as per the above behaviour. Using frappeframework/GanttView as reference

The configuration file should be named {doctype}_calendar.js and should exist in the doctype directory.

As such, todo_calendar.js is modified with the following data-structure with exp_start_date and exp_end_date added to complete field.map.

frappe.views.calendar["ToDo"] = {
    field_map: {
        "start": "exp_start_date",
        "end": "exp_end_date",
        "id": "name",
        "title": "description",
        "allDay": "allDay",
        "progress": "progress"
    },
    gantt: {
        "order_by": "exp_start_date"
    },
    filters: [
        {
            "fieldtype": "Link",
            "fieldname": "reference_type",
            "options": "Task",
            "label": __("Task")
        },
        {
            "fieldtype": "Dynamic Link",
            "fieldname": "reference_name",
            "options": "reference_type",
            "label": __("Task")
        }

    ],
    get_events_method: "frappe.desk.calendar.get_events"
};

Item Creation

Incorrectly rendered Gantt Chart

As can be seen above, the delta between start and end date is incorrectly rendered.

Output of bench version

erpnext 13.18.0                                                                                                                     
frappe 13.18.0

Steps to reproduce the issue

  1. Modify todo_calendar.js by following frappeframework/GanttView as reference.
  2. create end DocType field and point it to the calendar view.

Observed result

Gantt chart bar incorrectly positions end-date. In addition, it also does not allow link to ToDo item.

Expected result

Project > Task > Gantt View works correctly: gantt_chart_rendered_correctly

Stacktrace / full error message

VM1900:1 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'getFullYear')
    at Object.start_of 
![Item Creation](https://user-images.githubusercontent.com/74222309/148885930-f2eee4da-b0bb-4f1f-a3ff-cd2cf3e1fc62.PNG)
(<anonymous>:1:2483)
    at p.setup_gantt_dates (<anonymous>:1:17282)
    at p.setup_dates (<anonymous>:1:16995)
    at p.change_view_mode (<anonymous>:1:16468)
    at new p (<anonymous>:1:14363)
    at frappe.views.GanttView.render_gantt (gantt_view.js:100)
    at gantt_view.js:83

Additional information

OS version / distribution, Frappe install method, etc. Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic

Frappe Manual Install version-13

skjbulcher commented 2 years ago

I have seen this behavior in my own app, when get_events_method get called, as in https://github.com/frappe/frappe/issues/13290. For some reason it is called for built-in DocTypes, but not for my custom doctype. It works in calendar view.

Nihantra-Patel commented 6 months ago

We no longer provide support for version 13 or older. If know about the Solution then raise the PR for the newer version.

Kindly upgrade to version 14 or 15.

Version EOL Branch
Version 12 End of 2022 version-12
Version 13 End of 2023 version-13
Version 14 End of 2024 (planned) version-14
Version 15 End of 2026 (planned) version-15
Bleeding edge N/A develop

For more information, please refer to the guidelines.

Thank You!