Skip to content

Commit

Permalink
[FIX] project: change personal stage edit display
Browse files Browse the repository at this point in the history
in the edit stage of the personal stage we should only display the name of the stage and the folded bool

Task-3276463

Part-of: odoo#119096
  • Loading branch information
bastvdn authored and xavierbol committed May 12, 2023
1 parent 5e55758 commit 1b35c5e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/** @odoo-module */

import { KanbanHeader } from "@web/views/kanban/kanban_header";
import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog";

export class ProjectTaskKanbanHeader extends KanbanHeader {
editGroup() {
const { resModel, value } = this.group;
const groupBy = this.props.list.groupBy;
if (groupBy.length !== 1 || groupBy[0] !== 'personal_stage_type_ids') {
super.editGroup();
return;
}
const context = Object.assign({}, this.group.context, {
form_view_ref: 'project.personal_task_type_edit',
});
this.dialog.add(FormViewDialog, {
context,
resId: value,
resModel: resModel,
title: this.env._t('Edit Personal Stage'),
onRecordSaved: async () => {
await this.props.list.load();
this.props.list.model.notify();
},
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { useService } from '@web/core/utils/hooks';
import { KanbanRenderer } from '@web/views/kanban/kanban_renderer';
import { FormViewDialog } from "@web/views/view_dialogs/form_view_dialog";
import { ProjectTaskKanbanRecord } from './project_task_kanban_record';
import { ProjectTaskKanbanHeader } from './project_task_kanban_header';

const { onWillStart } = owl;

Expand Down Expand Up @@ -72,30 +72,10 @@ export class ProjectTaskKanbanRenderer extends KanbanRenderer {
}
super.deleteGroup(group);
}

editGroup(group) {
const groupBy = this.props.list.groupBy;
if (groupBy.length !== 1 || groupBy[0] !== 'personal_stage_type_ids') {
super.editGroup(group);
return;
}
const context = Object.assign({}, group.context, {
form_view_ref: 'project.personal_task_type_edit',
});
this.dialog.add(FormViewDialog, {
context,
resId: group.value,
resModel: group.resModel,
title: this.env._t('Edit Personal Stage'),
onRecordSaved: async () => {
await this.props.list.load();
this.props.list.model.notify();
},
});
}
}

ProjectTaskKanbanRenderer.components = {
...KanbanRenderer.components,
KanbanRecord: ProjectTaskKanbanRecord,
KanbanHeader: ProjectTaskKanbanHeader,
};

0 comments on commit 1b35c5e

Please sign in to comment.