[IMP] project: Improve UX

Before this commit:
- project tasks view: when we group by company, milestone, customer,
worksheet template or any m2o field, the KanbanColumnQuickCreate is
displayed for that field, we can add a new one or apply examples,
but thoses examples are stages.
That doesn't make any sens to add them in a project or milestone context,
then if you add a new column manually or via the apply examples, it will
disappear once refreshing the page.
To summarize, stage is the only valid group by that can have the
KanbanColumnQuickCreate.

- all tasks view: same problem as the previous point + quick creating
is also not valid for group by stage as we are in all tasks context that
are linked to different project and the examples are mainly applied for a specific
project, if you try to add manually or via the examples and refresh they are going
to disappear as they are not linked to any project.

- my tasks view, same problem for previous point + quick creating when grouping
by personal stage is valid but apply examples  button is displayed to show stages and if
used, it will not add anything, so it should be hidden.

- Project Kanban examples stages are all created as not folded.
Some users don't know that 'folded in kanban' option is available on the stages,
and that tasks in a folded stage are considered as done.

After this commit:
- project tasks: KanbanColumnQuickCreate and applying examples are only available
when grouping by stage.

- all tasks: KanbanColumnQuickCreate is not available.

- my tasks: KanbanColumnQuickCreate is only available when grouping by personal stages.
applying examples is not available.

- some example stages are folded..

task-3092925

closes odoo/odoo#107633

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Abderraouf Ghrissi (abgh)
2023-04-07 11:37:03 +02:00
parent 5eb49e3712
commit bd6428515a
2 changed files with 30 additions and 13 deletions
@@ -14,85 +14,98 @@ const exampleData = {
ghostColumns: [_lt('New'), _lt('Assigned'), _lt('In Progress'), _lt('Done')],
applyExamplesText: _lt("Use This For My Project"),
allowedGroupBys: ['stage_id'],
foldField: "fold",
examples:[{
name: _lt('Software Development'),
columns: [_lt('Backlog'), _lt('Specifications'), _lt('Development'), _lt('Tests'), _lt('Delivered')],
columns: [_lt('Backlog'), _lt('Specifications'), _lt('Development'), _lt('Tests')],
foldedColumns: [_lt('Delivered')],
get description() {
return renderToMarkup("project.example.generic");
},
bullets: [greenBullet, redBullet, star],
}, {
name: _lt('Agile Scrum'),
columns: [_lt('Backlog'), _lt('Sprint Backlog'), _lt('Sprint in Progress'), _lt('Sprint Complete'), _lt('Old Completed Sprint')],
columns: [_lt('Backlog'), _lt('Sprint Backlog'), _lt('Sprint in Progress')],
foldedColumns: [_lt('Sprint Complete'), _lt('Old Completed Sprint')],
get description() {
return renderToMarkup("project.example.agilescrum");
},
bullets: [greenBullet, redBullet],
}, {
name: _lt('Digital Marketing'),
columns: [_lt('Ideas'), _lt('Researching'), _lt('Writing'), _lt('Editing'), _lt('Done')],
columns: [_lt('Ideas'), _lt('Researching'), _lt('Writing'), _lt('Editing')],
foldedColumns: [_lt('Done')],
get description() {
return renderToMarkup("project.example.digitalmarketing");
},
bullets: [greenBullet, redBullet],
}, {
name: _lt('Customer Feedback'),
columns: [_lt('New'), _lt('In development'), _lt('Done'), _lt('Refused')],
columns: [_lt('New'), _lt('In development')],
foldedColumns: [_lt('Done'), _lt('Refused')],
get description() {
return renderToMarkup("project.example.customerfeedback");
},
bullets: [greenBullet, redBullet],
}, {
name: _lt('Consulting'),
columns: [_lt('New Projects'), _lt('Resources Allocation'), _lt('In Progress'), _lt('Done')],
columns: [_lt('New Projects'), _lt('Resources Allocation'), _lt('In Progress')],
foldedColumns: [_lt('Done')],
get description() {
return renderToMarkup("project.example.consulting");
},
bullets: [greenBullet, redBullet],
}, {
name: _lt('Research Project'),
columns: [_lt('Brainstorm'), _lt('Research'), _lt('Draft'), _lt('Final Document')],
columns: [_lt('Brainstorm'), _lt('Research'), _lt('Draft')],
foldedColumns: [_lt('Final Document')],
get description() {
return renderToMarkup("project.example.researchproject");
},
bullets: [greenBullet, redBullet],
}, {
name: _lt('Website Redesign'),
columns: [_lt('Page Ideas'), _lt('Copywriting'), _lt('Design'), _lt('Live')],
columns: [_lt('Page Ideas'), _lt('Copywriting'), _lt('Design')],
foldedColumns: [_lt('Live')],
get description() {
return renderToMarkup("project.example.researchproject");
},
}, {
name: _lt('T-shirt Printing'),
columns: [_lt('New Orders'), _lt('Logo Design'), _lt('To Print'), _lt('Done')],
columns: [_lt('New Orders'), _lt('Logo Design'), _lt('To Print')],
foldedColumns: [_lt('Done')],
get description() {
return renderToMarkup("project.example.tshirtprinting");
},
bullets: [star],
}, {
name: _lt('Design'),
columns: [_lt('New Request'), _lt('Design'), _lt('Client Review'), _lt('Handoff')],
columns: [_lt('New Request'), _lt('Design'), _lt('Client Review')],
foldedColumns: [_lt('Handoff')],
get description() {
return renderToMarkup("project.example.generic");
},
bullets: [greenBullet, redBullet, star, clock],
}, {
name: _lt('Publishing'),
columns: [_lt('Ideas'), _lt('Writing'), _lt('Editing'), _lt('Published')],
columns: [_lt('Ideas'), _lt('Writing'), _lt('Editing')],
foldedColumns: [_lt('Published')],
get description() {
return renderToMarkup("project.example.generic");
},
bullets: [greenBullet, redBullet, star, clock],
}, {
name: _lt('Manufacturing'),
columns: [_lt('New Orders'), _lt('Material Sourcing'), _lt('Manufacturing'), _lt('Assembling'), _lt('Delivered')],
columns: [_lt('New Orders'), _lt('Material Sourcing'), _lt('Manufacturing'), _lt('Assembling')],
foldedColumns: [_lt('Delivered')],
get description() {
return renderToMarkup("project.example.generic");
},
bullets: [greenBullet, redBullet, star, clock],
}, {
name: _lt('Podcast and Video Production'),
columns: [_lt('Research'), _lt('Script'), _lt('Recording'), _lt('Mixing'), _lt('Published')],
columns: [_lt('Research'), _lt('Script'), _lt('Recording'), _lt('Mixing')],
foldedColumns: [_lt('Published')],
get description() {
return renderToMarkup("project.example.generic");
},
@@ -43,8 +43,12 @@ export class ProjectTaskKanbanRenderer extends KanbanRenderer {
}
}
isProjectTasksContext() {
return this.props.list.context.active_model === "project.project" && this.props.list.context.default_project_id;
}
canCreateGroup() {
return super.canCreateGroup() && (!this.props.list.isGroupedByStage || this.isProjectManager) || this.props.list.isGroupedByPersonalStages;
return (super.canCreateGroup() && this.isProjectTasksContext() && this.props.list.isGroupedByStage) || this.props.list.isGroupedByPersonalStages;
}
canDeleteGroup(group) {