From 6c54232c98d95e454389e0cc555bd5c83a89b698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 18 Oct 2013 15:21:20 +0200 Subject: [PATCH 01/10] [IMP] Stage/State update part 2 - stages: added some fields -- closed: indicates whether this stage close the working process, for example task ended, lead lost, applicant hired -- bar_fold: whether to hide the state in the statusbar; this is different from fold that is used for kanban views. Viewing a pipe or a specific record are effectively different things and should use different fields. -- bar_color: field to customize the stage in the statusbar (still WIP) - impacted addons: crm, project, project_issue, hr_recruitment - removed 'closed' addition in project_mrp as this is now in base project module bzr revid: tde@openerp.com-20131018132120-h0pv01q2bagtp99x --- addons/crm/crm.py | 13 ++++++++-- addons/crm/crm_lead_data.xml | 3 +++ addons/crm/crm_lead_view.xml | 4 --- addons/crm/crm_view.xml | 25 +++++++++++++------ addons/hr_recruitment/hr_recruitment.py | 15 ++++++++--- addons/hr_recruitment/hr_recruitment_data.xml | 3 +++ addons/hr_recruitment/hr_recruitment_view.xml | 7 +++++- addons/project/project.py | 24 +++++++++++++----- addons/project/project_data.xml | 3 +++ addons/project/project_view.xml | 14 ++++++++--- addons/project_issue/project_issue.py | 7 +++++- addons/project_issue/project_issue_view.xml | 7 +++--- addons/project_mrp/project_mrp.py | 16 ------------ 13 files changed, 93 insertions(+), 48 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index dc7ebf3ca95..9331fd2ff9e 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -68,8 +68,17 @@ class crm_case_stage(osv.osv): help="Link between stages and sales teams. When set, this limitate the current stage to the selected sales teams."), 'case_default': fields.boolean('Default to New Sales Team', help="If you check this field, this stage will be proposed by default on each sales team. It will not assign this stage to existing teams."), - 'fold': fields.boolean('Fold by Default', - help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), + '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.'), + 'bar_fold': fields.boolean('Folded in Status Bar', + help='This stage is folded in the form view when' + 'using the statusbar widget.'), + 'bar_color': fields.integer('Status Bar Color'), + 'closed': fields.boolean('Closing Stage', + help='Indicates whether this field is the end of' + 'the maangement process. This is for example a' + 'stage considering the lead as won or lost.'), 'type': fields.selection([('lead', 'Lead'), ('opportunity', 'Opportunity'), ('both', 'Both')], diff --git a/addons/crm/crm_lead_data.xml b/addons/crm/crm_lead_data.xml index 3c299fef704..33f2c4a7e65 100644 --- a/addons/crm/crm_lead_data.xml +++ b/addons/crm/crm_lead_data.xml @@ -18,6 +18,7 @@ 1 30 lead + Qualification @@ -48,6 +49,7 @@ 1 70 opportunity + Lost @@ -57,6 +59,7 @@ 1 80 opportunity + diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index c0eefcc8d4c..1c958f03ed5 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -379,10 +379,6 @@
-
diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index d0dcc07fcb0..16debe19eeb 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -93,14 +93,23 @@ - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 8664a2c1166..0af35850311 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -52,12 +52,21 @@ class hr_recruitment_stage(osv.osv): 'name': fields.char('Name', size=64, required=True, translate=True), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of stages."), 'department_id':fields.many2one('hr.department', 'Specific to a Department', help="Stages of the recruitment process may be different per department. If this stage is common to all departments, keep this field empty."), - 'fold': fields.boolean('Hide in views if empty', help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), 'requirements': fields.text('Requirements'), + '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.'), + 'bar_fold': fields.boolean('Folded in Status Bar', + help='This stage is folded in the form view when' + 'using the statusbar widget.'), + 'bar_color': fields.integer('Status Bar Color'), + 'closed': fields.boolean('Closing Stage', + help='Indicates whether this field is the end of' + 'the maangement process. This is for example a' + 'stage considering the applicant as hired or refused.'), } _defaults = { 'sequence': 1, - 'fold': False, } class hr_recruitment_degree(osv.osv): @@ -225,7 +234,7 @@ class hr_applicant(osv.Model): 'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c), 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c), 'color': 0, - 'date_last_stage_update': fields.datetime.now(), + 'date_last_stage_update': fields.datetime.now, } _group_by_full = { diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml index 854dea0548f..6279d88cba4 100644 --- a/addons/hr_recruitment/hr_recruitment_data.xml +++ b/addons/hr_recruitment/hr_recruitment_data.xml @@ -71,12 +71,15 @@ Contract Signed 5 + Refused 6 + + Job Survey 20 diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 3bf09d21a17..66ff4b98887 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -342,6 +342,8 @@ + + @@ -357,10 +359,13 @@ + + - + + diff --git a/addons/project/project.py b/addons/project/project.py index d153a849dc7..8a5774ebb58 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -41,14 +41,21 @@ 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'), - 'fold': fields.boolean('Folded by Default', - help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."), + '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.'), + 'bar_fold': fields.boolean('Folded in Status Bar', + help='This stage is folded in the form view when' + 'using the statusbar widget.'), + 'bar_color': fields.integer('Status Bar Color'), + 'closed': fields.boolean('Closing Stage', + help='Indicates whether this field is the end of' + 'the maangement process. This is for example a' + 'stage considering the record as done or canceled.'), } _defaults = { 'sequence': 1, - 'fold': False, - 'case_default': False, 'project_ids': lambda self, cr, uid, ctx=None: self.pool['project.task']._get_default_project_id(cr, uid, context=ctx), } _order = 'sequence' @@ -189,6 +196,8 @@ class project(osv.osv): return res def _task_count(self, cr, uid, ids, field_name, arg, context=None): + """ :deprecated: this method will be removed with OpenERP v8. Use task_ids + fields instead. """ if context is None: context = {} res = dict.fromkeys(ids, 0) @@ -263,7 +272,10 @@ class project(osv.osv): }), 'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)]} ), 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), - 'task_count': fields.function(_task_count, type='integer', string="Open Tasks"), + 'task_count': fields.function(_task_count, type='integer', string="Open Tasks", + deprecated="This field will be removed in OpenERP v8. Use task_ids one2many field instead."), + 'task_ids': fields.one2many('project.task', 'project_id', + domain=[('stage_id.closed', '=', False)]), 'color': fields.integer('Color Index'), 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="Internal email associated with this project. Incoming emails are automatically synchronized" @@ -804,7 +816,7 @@ class task(osv.osv): _defaults = { 'stage_id': _get_default_stage_id, 'project_id': _get_default_project_id, - 'date_last_stage_update': lambda *a: fields.datetime.now(), + 'date_last_stage_update': fields.datetime.now, 'kanban_state': 'normal', 'priority': '2', 'progress': 0, diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 0f48dfe9a2b..78cccb6008c 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -63,12 +63,15 @@ Done + 30 Cancelled + + diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 4d025d15cb4..4db5c3c9445 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -240,6 +240,7 @@ + @@ -259,9 +260,10 @@ %%
@@ -684,11 +686,14 @@ + + - + + @@ -704,6 +709,7 @@ + diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 351b55fdcfc..1cbecbac93c 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -570,6 +570,8 @@ class project(osv.Model): return [('project.task', "Tasks"), ("project.issue", "Issues")] def _issue_count(self, cr, uid, ids, field_name, arg, context=None): + """ :deprecated: this method will be removed with OpenERP v8. Use issue_ids + fields instead. """ res = dict.fromkeys(ids, 0) issue_ids = self.pool.get('project.issue').search(cr, uid, [('project_id', 'in', ids)]) for issue in self.pool.get('project.issue').browse(cr, uid, issue_ids, context): @@ -581,7 +583,10 @@ class project(osv.Model): 'project_escalation_id': fields.many2one('project.project', 'Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close': [('readonly', True)], 'cancelled': [('readonly', True)]}), - 'issue_count': fields.function(_issue_count, type='integer', string="Unclosed Issues"), + 'issue_count': fields.function(_issue_count, type='integer', string="Unclosed Issues", + deprecated="This field will be removed in OpenERP v8. Use issue_ids one2many field instead."), + 'issue_ids': fields.one2many('project.issue', 'project_id', + domain=[('stage_id.closed', '=', False)]) } def _check_escalation(self, cr, uid, ids, context=None): diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 3e90a2a43d6..02db9114bdb 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -325,13 +325,14 @@ - + - Issues - Issue + + Issue + Issues diff --git a/addons/project_mrp/project_mrp.py b/addons/project_mrp/project_mrp.py index d7880ba90cd..fbbba711b4c 100644 --- a/addons/project_mrp/project_mrp.py +++ b/addons/project_mrp/project_mrp.py @@ -23,22 +23,6 @@ from openerp.osv import fields, osv from openerp import netsvc -class ProjectTaskStageMrp(osv.Model): - """ Override project.task.type model to add a 'closed' boolean field allowing - to know that tasks in this stage are considered as closed. Indeed since - OpenERP 8.0 status is not present on tasks anymore, only stage_id. """ - _name = 'project.task.type' - _inherit = 'project.task.type' - - _columns = { - 'closed': fields.boolean('Close', help="Tasks in this stage are considered as closed."), - } - - _defaults = { - 'closed': False, - } - - class project_task(osv.osv): _name = "project.task" _inherit = "project.task" From 2cb3b0f382e25c77358ae705872ff92c99f0c6b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 18 Oct 2013 16:44:48 +0200 Subject: [PATCH 02/10] [FIX] sale_crm: fixed view inheritance TODO: re-add the button in invisible bzr revid: tde@openerp.com-20131018144448-hpbds5oobcqpr1uv --- addons/crm/crm_lead.py | 8 ++++++-- addons/sale_crm/sale_crm_view.xml | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 046d4419809..e2af3739fe0 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -387,7 +387,9 @@ class crm_lead(format_address, osv.osv): return False def case_mark_lost(self, cr, uid, ids, context=None): - """ Mark the case as lost: state=cancel and probability=0 """ + """ Mark the case as lost: state=cancel and probability=0 + :deprecated: this method will be removed in OpenERP v8. + """ for lead in self.browse(cr, uid, ids): stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 0.0), ('on_change', '=', True), ('sequence', '>', 1)], context=context) if stage_id: @@ -399,7 +401,9 @@ class crm_lead(format_address, osv.osv): 'Create a specific stage or edit an existing one by editing columns of your opportunity pipe.')) def case_mark_won(self, cr, uid, ids, context=None): - """ Mark the case as won: state=done and probability=100 """ + """ Mark the case as won: state=done and probability=100 + :deprecated: this method will be removed in OpenERP v8. + """ for lead in self.browse(cr, uid, ids): stage_id = self.stage_find(cr, uid, [lead], lead.section_id.id or False, [('probability', '=', 100.0), ('on_change', '=', True), ('sequence', '>', 1)], context=context) if stage_id: diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml index 34f32e0b58b..8c008339903 100644 --- a/addons/sale_crm/sale_crm_view.xml +++ b/addons/sale_crm/sale_crm_view.xml @@ -8,7 +8,7 @@ - +