From dd343c86330467ba6cfffb62e22b643a004fb764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 31 Oct 2014 14:02:40 +0100 Subject: [PATCH] [IMP] project: kanban customization - stage model (project.task.type): add fields holding the eventual specific legends for kanban states and star (priority) management - project: task now have labels; you may use project to hold trainings instead of tasks. - project form: use label field on tasks statinfo to use the label - project.task form: use kanban state customization using states_legend option; - project.task kanban: use kanban column and kanban state cuztomization using group_by_tooltip and states_legend options - project_issue: issues now have labels, like tasks. - issue: same kanban custo as for tasks - update data and demo data [IMP] web: statinfo widget now take an optional label_field option allowing to have strings coming from another field present in the form view --- addons/project/project.py | 16 +++++++++- addons/project/project_data.xml | 5 ++++ addons/project/project_demo.xml | 3 ++ addons/project/project_view.xml | 33 +++++++++++++-------- addons/project_issue/project_issue.py | 7 ++++- addons/project_issue/project_issue_demo.xml | 3 ++ addons/project_issue/project_issue_view.xml | 23 ++++++++------ addons/web/static/src/js/view_form.js | 7 ++++- 8 files changed, 73 insertions(+), 24 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 1e4c91796d8..a83962edc5c 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -44,6 +44,18 @@ class project_task_type(osv.osv): 'case_default': fields.boolean('Default for New Projects', help="If you check this field, this stage will be proposed by default on each new project. It will not assign this stage to existing projects."), 'project_ids': fields.many2many('project.project', 'project_task_type_rel', 'type_id', 'project_id', 'Projects'), + 'legend_priority': fields.text( + 'Priority Management Explanation', translate=True, + help='Explanation text to help users using the star and priority mechanism on stages or issues that are in this stage.'), + 'legend_blocked': fields.char( + 'Kanban Blocked Explanation', translate=True, + help='Override the default value displayed for the blocked state for kanban selection, when the task or issue is in that stage.'), + 'legend_done': fields.char( + 'Kanban Valid Explanation', translate=True, + help='Override the default value displayed for the done state for kanban selection, when the task or issue is in that stage.'), + 'legend_normal': fields.char( + 'Kanban Ongoing Explanation', translate=True, + help='Override the default value displayed for the normal state for kanban selection, when the task or issue is in that stage.'), 'fold': fields.boolean('Folded in Kanban View', help='This stage is folded in the kanban view when' 'there are no records in that stage to display.'), @@ -280,6 +292,7 @@ class project(osv.osv): help="Link this project to an analytic account if you need financial management on projects. " "It enables you to connect projects with budgets, planning, cost and revenue analysis, timesheets on projects, etc.", ondelete="cascade", required=True, auto_join=True), + 'label_tasks': fields.char('Use Tasks as', help="Gives label to tasks on project's kanaban view."), 'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's members are users who can have an access to the tasks related to this project.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'tasks': fields.one2many('project.task', 'project_id', "Task Activities"), @@ -347,6 +360,7 @@ class project(osv.osv): _defaults = { 'active': True, 'type': 'contract', + 'label_tasks': 'Tasks', 'state': 'open', 'sequence': 10, 'type_ids': _get_type_common, @@ -1230,7 +1244,7 @@ class account_analytic_account(osv.osv): _inherit = 'account.analytic.account' _description = 'Analytic Account' _columns = { - 'use_tasks': fields.boolean('Tasks',help="If checked, this contract will be available in the project menu and you will be able to manage tasks or track issues"), + 'use_tasks': fields.boolean('Tasks', help="If checked, this contract will be available in the project menu and you will be able to manage tasks or track issues"), 'company_uom_id': fields.related('company_id', 'project_time_mode_id', string="Company UOM", type='many2one', relation='product.uom'), } diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index bf3eed10aae..d4d39077dd3 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -33,11 +33,15 @@ 1 To Do + Not validated + Use the priority for tasks related to gold customers 10 In Progress + Need functional or technical help + Buzz or set as done @@ -50,6 +54,7 @@ 30 Cancelled + Ready to reopen diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml index 74c35b97bb5..6289396b814 100644 --- a/addons/project/project_demo.xml +++ b/addons/project/project_demo.xml @@ -63,6 +63,7 @@ 10 E-Learning Integration + Trainings project.task employees @@ -77,6 +78,7 @@ 20 Website Design Templates + Designs followers project.task @@ -93,6 +95,7 @@ Data Import/Export Plugin + Databases project.task followers -
- -
@@ -493,15 +498,14 @@ project.task.kanban project.task - + - + - @@ -547,7 +551,8 @@
- +
@@ -705,11 +710,15 @@ - - + + + + + +
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 51a7c813197..bc9e879b901 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -548,8 +548,13 @@ class account_analytic_account(osv.Model): class project_project(osv.Model): _inherit = 'project.project' + _columns = { + 'label_issues': fields.char('Use Issues as', help="Customize the issues label, for example to call them cases."), + } + _defaults = { - 'use_issues': True + 'use_issues': True, + 'label_issues': 'Issues', } def _check_create_write_values(self, cr, uid, vals, context=None): diff --git a/addons/project_issue/project_issue_demo.xml b/addons/project_issue/project_issue_demo.xml index ef012a1a6e9..6241d0ccf69 100644 --- a/addons/project_issue/project_issue_demo.xml +++ b/addons/project_issue/project_issue_demo.xml @@ -7,12 +7,15 @@ + Bugs + Feedbacks + Bugs diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 04c2f54531f..ee6b123cdfa 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -58,7 +58,10 @@
- +
- Issues + Closed Issues diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 20cba67c5a1..15f6e80f509 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -6233,7 +6233,12 @@ instance.web.form.StatInfo = instance.web.form.AbstractField.extend({ value: this.get("value") || 0, }; if (! this.node.attrs.nolabel) { - options.text = this.string + if(this.options.label_field && this.view.datarecord[this.options.label_field]) { + options.text = this.view.datarecord[this.options.label_field]; + } + else { + options.text = this.string; + } } this.$el.html(QWeb.render("StatInfo", options)); },