[IMP] project: improve calendar view

Before this commit, the calendar view showcases tasks by deadline. Because it is a simple date field, the day/week modes don't have much value and are even confusing to the users, who expect to be able to define timeframes.

In addition, the quickcreate doesn't allow to select a project. This is problematic because it leads to "ghost" tasks.

closes odoo/odoo#52478

Taskid: 2264594
Related: odoo/enterprise#10976
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Arnaud Joset
2020-06-23 07:56:16 +00:00
parent b88c755b35
commit 6b95f0c144
4 changed files with 33 additions and 3 deletions
@@ -0,0 +1,22 @@
odoo.define('project.ProjectCalendarView', function (require) {
"use strict";
const CalendarController = require('web.CalendarController');
const CalendarView = require('web.CalendarView');
const viewRegistry = require('web.view_registry');
const ProjectCalendarController = CalendarController.extend({
_renderButtonsParameters() {
return _.extend({}, this._super(...arguments), {scaleDrop: true});
},
});
const ProjectCalendarView = CalendarView.extend({
config: _.extend({}, CalendarView.prototype.config, {
Controller: ProjectCalendarController,
}),
});
viewRegistry.add('project_calendar', ProjectCalendarView);
return ProjectCalendarView;
});
+1
View File
@@ -7,6 +7,7 @@
<script type="text/javascript" src="/project/static/src/js/project_rating_reporting.js"></script>
<script type="text/javascript" src="/project/static/src/js/project_task_kanban_examples.js"></script>
<script type="text/javascript" src="/project/static/src/js/tours/project.js"></script>
<script type="text/javascript" src="/project/static/src/js/project_calendar.js"></script>
<link rel="stylesheet" type="text/scss" href="/project/static/src/scss/project_dashboard.scss"/>
</xpath>
</template>
+2 -1
View File
@@ -873,7 +873,8 @@
<field name="model">project.task</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<calendar date_start="date_deadline" string="Tasks" mode="month" color="user_id" event_limit="5" hide_time="true">
<calendar date_start="date_deadline" string="Tasks" mode="month" color="user_id" event_limit="5"
hide_time="true" quick_add="False" js_class="project_calendar">
<field name="user_id" avatar_field="image_128" filters="1"/>
<field name="date_deadline"/>
<field name="project_id"/>
+8 -2
View File
@@ -91,8 +91,14 @@
<t t-name="CalendarView.buttons">
<div class="o_calendar_buttons">
<t t-call="CalendarView.navigation_buttons" />
<t t-call="CalendarView.scale_buttons" />
<span class="o_calendar_navigation_buttons">
<t t-call="CalendarView.navigation_buttons" />
</span>
<t t-if="!scaleDrop">
<span class="o_calendar_scale_buttons">
<t t-call="CalendarView.scale_buttons" />
</span>
</t>
</div>
</t>