21-Advanced Views - Gantt View in Odoo 13

Gantt view provides a timeline view for the data. Generally, it can be used to display project tasks and resource allocation in odoo 13.

A Gantt chart is a graphical display of all the tasks that a project is composed of. Each bar on the chart is a graphical representation of the length of time the task is planned to take.

Get the module from our repository: https://github.com/CybroOdoo/openacademy

The root element of Gantt views is (angle bracket)gantt/(angle bracket), it has no children but can take the following attributes:

date_start (required)
name of the field providing the start date-time of the event for each record.

date_stop (required)
name of the field providing the end duration of the event for each record.

color
name of the field used to color the pills according to its value

decoration-{$name}
allow changing the style of a row’s text based on the corresponding record’s attributes.

default_group_by
name of a field to group tasks by

consolidation
field name to display consolidation value in record cell

consolidation_max
dictionary with the “group by” field as key and the maximum consolidation value that can be reached before displaying the cell in red (e.g. {"user_id": 100})

consolidation_exclude
name of the field that describes if the task has to be excluded from the consolidation if set to true it displays a striped zone in the consolidation line

create, edit, plan
allows disabling the corresponding action in the view by setting the corresponding attribute to false. If create is enabled, a “+” button will be displayed while hovering each time slot to create a new record in that slot, and if edit is enabled, a “magnifying glass” button will be displayed to plan records into that time slot.
offset

Depending on the scale, the number of units to add to today to compute the default period. Examples: An offset of +1 in default_scale week will open the gantt view for next week, and an offset of -2 in default_scale month will open the gantt view of 2 months ago.

progress
name of a field providing the completion percentage for the record’s event, between 0 and 100

string
title of the gantt view

precision
JSON object specifying snapping precisions for the pills in each scale.

Possible values for scale day are (default: hour):

hour: records times snap to full hours (ex: 7:12 becomes 8:00)

hour:half: records times snap to half hours (ex: 7:12 becomes 7:30)

hour:quarter: records times snap to half hours (ex: 7:12 becomes 7:15)

Possible values for scale week are (default: day:half):

day: records times snap to full days (ex: 7:28 AM becomes 11:59:59 PM)

day:half: records times snap to half hours (ex: 7:28 AM becomes 12:00 PM)

Possible values for scale month are (default: day:half):

day: records times snap to full days (ex: 7:28 AM becomes 11:59:59 PM)

day:half: records times snap to half hours (ex: 7:28 AM becomes 12:00 PM)

Scale year always snap to full day.
Example of precision attribute: {"day": "hour:quarter", "week": "day:half", "month": "day"}

total_row
boolean to control whether the row containing the total count of records should be displayed. (default: false)

collapse_first_level
boolean to control whether it is possible to collapse each row if grouped by one field. (default: false, the collapse starts when grouping by two fields)

display_unavailability
boolean to mark the dates returned by the gantt_unavailability function of the model as available inside the gantt view. Records can still be scheduled in them, but their unavailability is visually displayed. (default: false)

default_scale
default scale when rendering the view. Possible values are (default: month):

- day
- week
- month
- year

scales
comma-separated list of allowed scales for this view. By default, all scales are allowed. For possible scale values to use in this list, see default_scale.

templates
defines the QWeb template gantt-popover which is used when the user hovers over one of the records in the gantt view.
The gantt view uses mostly-standard javascript qweb and provides the following context variables:

widget
the current GanttRow(), can be used to fetch some meta-information. The getColor method to convert in a color integer is also available directly in the template context without using widget.
on_create If specified when clicking the add button on the view, instead of opening a generic dialog, launch a client action. this should hold the xmlid of the action (eg: on_create="%(my_module.my_wizard)d"

form_view_id
view to open when the user create or edit a record. Note that if this attribute is not set, the gantt view will fall back to the id of the form view in the current action, if any.

#odoo13 #odootutorials #odooganttview
More videos Subscribe to our YouTube channel.

Visit our company website: https://www.cybrosys.com/

Connect with us:
Facebook: http://ow.ly/Ty0Q30lc5TU
twitter: http://ow.ly/s5cV30lc5Vc
LinkedIn: http://ow.ly/GJfg30lc5WT
Views
4000 Total Views
1 Members Views
3999 Public Views
Share on Social Networks
Share Link
Use permanent link to share in social media
Share by mail

Please login to share this video by email.

Embed in your website