From 58a90952edb715dc89d46d953fb23be3158396da Mon Sep 17 00:00:00 2001 From: Kevin Baptiste Date: Wed, 4 Mar 2020 14:48:17 +0000 Subject: [PATCH] [IMP] project: improve usability (back2basics) * Reword tasks in the sample project * Add a "Create and Edit" button on the project creation modal * Open the file chooser in "Set a cover image" if there are no images set * Correclty display the kanban state button on archived task * Add a button to list the tasks when deleting a project * Open file chooser for cover image: Automatically open the file chooser when setting a cover image on a task if there are no attachments to chose from. closes odoo/odoo#47306 Taskid: 2209133 Related: odoo/enterprise#9141 Signed-off-by: Yannick Tivisse (yti) --- .../hr_timesheet/data/hr_timesheet_data.xml | 6 + addons/hr_timesheet/views/project_views.xml | 2 +- addons/project/__init__.py | 1 + addons/project/__manifest__.py | 1 + addons/project/data/project_data.xml | 159 ++++++++++-------- addons/project/models/project.py | 33 +++- addons/project/security/ir.model.access.csv | 1 + addons/project/static/src/css/project.css | 5 + addons/project/views/project_views.xml | 24 ++- .../views/res_config_settings_views.xml | 4 +- addons/project/wizard/__init__.py | 4 + .../project/wizard/project_delete_wizard.py | 24 +++ .../wizard/project_delete_wizard_views.xml | 28 +++ .../sale_project/views/project_task_views.xml | 2 +- .../views/project_task_views.xml | 2 +- .../src/js/views/kanban/kanban_record.js | 11 +- 16 files changed, 220 insertions(+), 87 deletions(-) create mode 100644 addons/project/wizard/__init__.py create mode 100644 addons/project/wizard/project_delete_wizard.py create mode 100644 addons/project/wizard/project_delete_wizard_views.xml diff --git a/addons/hr_timesheet/data/hr_timesheet_data.xml b/addons/hr_timesheet/data/hr_timesheet_data.xml index 8fb4eb76cf6..0bb3c0dd642 100644 --- a/addons/hr_timesheet/data/hr_timesheet_data.xml +++ b/addons/hr_timesheet/data/hr_timesheet_data.xml @@ -23,4 +23,10 @@ hr_timesheet.timesheet_min_duration 15 + + + + + + diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml index 9385d4ac042..dd51e1f8d57 100644 --- a/addons/hr_timesheet/views/project_views.xml +++ b/addons/hr_timesheet/views/project_views.xml @@ -117,7 +117,7 @@ diff --git a/addons/project/__init__.py b/addons/project/__init__.py index 5905766d867..4e9b019bd7a 100644 --- a/addons/project/__init__.py +++ b/addons/project/__init__.py @@ -4,3 +4,4 @@ from . import controllers from . import models from . import report +from . import wizard diff --git a/addons/project/__manifest__.py b/addons/project/__manifest__.py index 490da2229a9..ef03cb8f296 100644 --- a/addons/project/__manifest__.py +++ b/addons/project/__manifest__.py @@ -37,6 +37,7 @@ 'data/digest_data.xml', 'data/project_mail_template_data.xml', 'data/project_data.xml', + 'wizard/project_delete_wizard_views.xml', ], 'demo': ['data/project_demo.xml'], 'test': [ diff --git a/addons/project/data/project_data.xml b/addons/project/data/project_data.xml index b2b6d043752..d78834cfad2 100644 --- a/addons/project/data/project_data.xml +++ b/addons/project/data/project_data.xml @@ -99,19 +99,19 @@ 1 - Basic + First Steps 2 - Advanced + Getting Better 3 - Expert + Wow... You're Amazing! @@ -122,52 +122,56 @@ Welcome to Odoo - Welcome! This project has the objective to show you all the main feature in the project app. Each card will help you to manage your projects easily in a few minutes. + +

Welcome!

+

This project has the objective to show you all the main features from the project app.

+

Each card will teach you tips and tricks to easily manage your projects and tasks.

+
2 + 5 + + 0 + + Try to play with the filters + +

Go back to the tasks view to play with the filters. Try to identify unassigned tasks or tasks that are overdue, for instance.

+

Hint: the filters and the search bar are available in the top right corner of your screen.

+
+ +
+ + 2 0 - - Try to play with the search bar. Use the filters - Come back to the tasks view to play with the filters. They are up to the form - - - - - 3 - - 0 - - - Try to drag a task wherever your want + Try to drag & drop this task wherever your want + ... or try changing the status of your task from here. done - 4 + 3 0 - - Guess what happens if you set this task as favorite? - Click on the top left star to change the priority and come back in the tasks view. You task is now at the top of the column. + Star this task to prioritize it +

Click on the top left icon to prioritize this task and go back to the kanban view.

Your task is now at the top of the stage.

+ 3 0 - - Use the chatter to collaborate with your members - The chatter is right below - + Use the chatter to collaborate with your team + @@ -175,90 +179,109 @@ project.task - Use this chatter to send emails. Add new people in the followers list, to make them aware about the main changes about this task! + Use this chatter to send emails. Add new people in the followers list to make them aware about the main changes about this task. email + + Converse with your customers and colleagues + project.task + + + Use @ mentions to ping a colleague or # mentions to contact an entire team. The people following this task won't be notified of the note you are logging unless you specifically tag them. + comment + + + + + 4 + + 0 + + Organize your work by using activities. + + + + + + + + + Use activities to organize your work. Try marking this activity as done. + + + + Need Assistance - 3 + 1 0 - - Use tags to organize your tasks + Use tags to categorize your tasks blocked - Tags will be represented by colored bars on the card +

Tags will be represented by colored dots on your task's card.

+

Click on a tag to define its color.

+

Tip: you can also define a color for your task from the tasks view.

+ 1 + + 0 + + 3 + Try to customize this card. Change its background. + Use the edit icon on the card from the tasks view to customize its background. + + + + 4 0 - - 3 - Try to customize this card. Change its background. - Use the edit icon on the card to customize the background. - - - - - 5 - - 0 - - - Set this task as 'Ready for next stage' to proceed further in the process - You can change its state by clicking on the small circle on the card, or here, next to the task title. - - - - - - 0 - - - Finished with this stage? Archive it ! - - Click on the gear icon on the column, to archive the stage, with all the tasks in it. You can also archive one card only, by clicking on the button in the task form view. + Set this task as being 'Ready for next stage' +

You can change this task's state by clicking on the small circle on the card, or here, next to the task's title.

+

Kanban states are perfect to let your colleagues know that your task is ready to be proceeded or that you need help on something.

+
+ 2 0 - - You want to add a stage? Add a new column ! + You want to add a stage? Add a new column! - Click on the last column to create a stage. The name depends on the process. For example, in a customer service process, a stage name may be 'Backlog', 'Waiting Customer Feedback' or 'Done'. +

Click on the last column of your tasks view to create a stage.

Feel free to adapt the steps to your business workflow by drag & dropping your stages in the right places.

Tip: You can also fold the stages you don't need to see permanently.

- + + 2 0 - You can set a deadline on a task +

Deadlines are useful to get things done on time.

You will get visual clues when the due date is close or due.

- +
- - + + 5 0 + - - Send a message with a picture as attachment, and see what happens! - - In the chatter, sending an email with an attachment will display the picture on the card. When there are several image attachments, you can choose which one you want to display. + Assign yourself to this task + diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 09fef75a8a7..dea89f2c05e 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -5,7 +5,7 @@ import ast from datetime import timedelta from odoo import api, fields, models, tools, SUPERUSER_ID, _ -from odoo.exceptions import UserError, AccessError, ValidationError +from odoo.exceptions import UserError, AccessError, ValidationError, RedirectWarning from odoo.tools.misc import format_date @@ -132,6 +132,10 @@ class Project(models.Model): Create a new project

''') }) action_data = action.read()[0] + + action_config = self.env.ref('project.open_view_project_all_config', False) + if action_config: + action_config.sudo().write({'help': action.help}) # Reload the dashboard return action_data @@ -352,6 +356,22 @@ class Project(models.Model): return res + def action_unlink(self): + wizard = self.env['project.delete.wizard'].create({ + 'project_ids': self.ids + }) + + return { + 'name': _('Confirmation'), + 'view_mode': 'form', + 'res_model': 'project.delete.wizard', + 'views': [(self.env.ref('project.project_delete_wizard_form').id, 'form')], + 'type': 'ir.actions.act_window', + 'res_id': wizard.id, + 'target': 'new', + 'context': self.env.context, + } + def unlink(self): # Check project is empty for project in self.with_context(active_test=False): @@ -507,9 +527,9 @@ class Task(models.Model): domain="[('project_ids', '=', project_id)]", copy=False) tag_ids = fields.Many2many('project.tags', string='Tags') kanban_state = fields.Selection([ - ('normal', 'Grey'), - ('done', 'Green'), - ('blocked', 'Red')], string='Kanban State', + ('normal', 'In Progress'), + ('done', 'Ready'), + ('blocked', 'Blocked')], string='Kanban State', copy=False, default='normal', required=True) kanban_state_label = fields.Char(compute='_compute_kanban_state_label', string='Kanban State Label', tracking=True) create_date = fields.Datetime("Created On", readonly=True, index=True) @@ -943,6 +963,11 @@ class Task(models.Model): return headers def _message_post_after_hook(self, message, msg_vals): + if message.attachment_ids and not self.displayed_image_id: + image_attachments = message.attachment_ids.filtered(lambda a: a.mimetype == 'image') + if image_attachments: + self.displayed_image_id = image_attachments[0] + if self.email_from and not self.partner_id: # we consider that posting a message with a specified recipient (not a follower, a specific one) # on a document without customer means that it was created through the chatter using diff --git a/addons/project/security/ir.model.access.csv b/addons/project/security/ir.model.access.csv index c6e0fc445d9..ad520ea8b56 100644 --- a/addons/project/security/ir.model.access.csv +++ b/addons/project/security/ir.model.access.csv @@ -23,3 +23,4 @@ access_mail_activity_type_project_manager,mail.activity.type.project.manager,mai access_account_analytic_account_user,account.analytic.account,analytic.model_account_analytic_account,project.group_project_user,1,0,0,0 access_account_analytic_account_manager,account.analytic.account,analytic.model_account_analytic_account,project.group_project_manager,1,1,1,1 access_account_analytic_line_project,account.analytic.line project,analytic.model_account_analytic_line,project.group_project_manager,1,1,1,1 +access_project_delete_wizard,access_project_delete_wizard,model_project_delete_wizard,project.group_project_manager,1,1,1,1 diff --git a/addons/project/static/src/css/project.css b/addons/project/static/src/css/project.css index f1599a7b21d..19f265cd2c6 100644 --- a/addons/project/static/src/css/project.css +++ b/addons/project/static/src/css/project.css @@ -65,3 +65,8 @@ .o_kanban_project_tasks .badge-danger { border-color: var(--danger); } + +.o_form_project_tasks .ribbon:not(.o_invisible_modifier) + div > h1 > div[name="kanban_state"] { + margin-right: 150px; + padding-left: 1rem; +} diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index d0b8b214754..40231d1d83e 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -94,7 +94,7 @@ project.project.form project.project -
+
@@ -242,7 +242,7 @@ project.project.tree project.project - + @@ -458,7 +458,7 @@

Create a new project

- Organize your activities (plan tasks, track issues, invoice timesheets) for internal, personal or customer projects. + Or activate a sample project to play with.

@@ -514,10 +514,6 @@ domain="[('parent_id', '=', False)]" attrs="{'invisible' : [('allow_subtasks', '=', False)]}" /> - - - - @@ -575,6 +571,15 @@ target="new" /> + + Delete + + + form,list + code + action = records.action_unlink() + + project.task.form.quick_create project.task @@ -642,7 +647,7 @@