[IMP] project, web: modify calendar filter in project calendar view
In this commit, we renamed the calendar filter in task from 'Undefined' to 'Private' to be consistent with the terminology used in the other views task. task-3214107 closes odoo/odoo#115621 Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { CalendarController } from "@web/views/calendar/calendar_controller";
|
||||
import { ProjectCalendarFilterPanel } from "./project_calendar_filter_panel/project_calendar_filter_panel";
|
||||
|
||||
export class ProjectCalendarController extends CalendarController {
|
||||
static components = {
|
||||
...ProjectCalendarController.components,
|
||||
FilterPanel: ProjectCalendarFilterPanel,
|
||||
};
|
||||
setup() {
|
||||
super.setup(...arguments);
|
||||
this.displayName += this.env._t(" - Tasks by Deadline");
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { CalendarFilterPanel } from "@web/views/calendar/filter_panel/calendar_filter_panel";
|
||||
|
||||
export class ProjectCalendarFilterPanel extends CalendarFilterPanel { }
|
||||
|
||||
ProjectCalendarFilterPanel.subTemplates = {
|
||||
filter: "project.ProjectCalendarFilterPanel.filter",
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="project.ProjectCalendarFilterPanel.filter" t-inherit="web.CalendarFilterPanel.filter" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="//span[@t-esc='filter.label']" position="before">
|
||||
<span t-if="props.model.isCheckProject and !filter.value" class="text-danger pe-1">
|
||||
<i class="fa fa-lock">
|
||||
</t>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
@@ -0,0 +1,16 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { CalendarModel } from '@web/views/calendar/calendar_model';
|
||||
|
||||
export class ProjectCalendarModel extends CalendarModel {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
get defaultFilterLabel() {
|
||||
this.isCheckProject = 'project_id' in this.meta.filtersInfo;
|
||||
if (this.isCheckProject) {
|
||||
return this.env._t("Private");
|
||||
}
|
||||
return super.onWillStart();
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,12 @@ import { registry } from "@web/core/registry";
|
||||
import { calendarView } from "@web/views/calendar/calendar_view";
|
||||
import { ProjectCalendarController } from "@project/views/project_calendar/project_calendar_controller";
|
||||
import { ProjectControlPanel } from "@project/components/project_control_panel/project_control_panel";
|
||||
import { ProjectCalendarModel } from "./project_calendar_model";
|
||||
|
||||
export const projectCalendarView = {
|
||||
...calendarView,
|
||||
Controller: ProjectCalendarController,
|
||||
Model: ProjectCalendarModel,
|
||||
ControlPanel: ProjectControlPanel,
|
||||
};
|
||||
registry.category("views").add("project_calendar", projectCalendarView);
|
||||
|
||||
@@ -139,6 +139,10 @@ export class CalendarModel extends Model {
|
||||
return this.meta.quickCreateFormViewId;
|
||||
}
|
||||
|
||||
get defaultFilterLabel() {
|
||||
return _t("Undefined");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
async createFilter(fieldName, filterValue) {
|
||||
@@ -732,7 +736,7 @@ export class CalendarModel extends Model {
|
||||
type: "dynamic",
|
||||
recordId: null,
|
||||
value,
|
||||
label: formatter(rawValue, { field }) || _t("Undefined"),
|
||||
label: formatter(rawValue, { field }) || this.defaultFilterLabel,
|
||||
active: previousFilter ? previousFilter.active : true,
|
||||
canRemove: false,
|
||||
colorIndex,
|
||||
|
||||
Reference in New Issue
Block a user