From f55de6c9e2acd498235feaf52f7daa6705beb50e Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Thu, 20 Jun 2013 17:32:28 +0530 Subject: [PATCH] [IMP]: analysis view of project task,issue, hr applicant and crm opportunity bzr revid: aja@tinyerp.com-20130620120228-upu5qsnk0j1tali6 --- addons/base_status/base_stage.py | 26 ++++++++++++++++++ addons/crm/crm_lead.py | 14 +++++----- addons/crm/crm_lead_view.xml | 7 +++-- addons/crm_partner_assign/crm_lead_view.xml | 4 +++ addons/hr_recruitment/hr_recruitment.py | 7 ++++- addons/hr_recruitment/hr_recruitment_data.xml | 12 +++------ addons/hr_recruitment/hr_recruitment_view.xml | 2 ++ .../report/hr_recruitment_report.py | 2 +- addons/project/project.py | 6 +++-- addons/project/project_data.xml | 24 +++++------------ addons/project/project_view.xml | 1 + addons/project/report/project_report.py | 24 ++++++++++++++--- addons/project/report/project_report_view.xml | 5 ++++ addons/project_issue/project_issue.py | 13 +++++---- addons/project_issue/project_issue_data.xml | 24 +++++------------ addons/project_issue/project_issue_view.xml | 7 ++++- .../report/project_issue_report.py | 27 ++++++++++++++----- .../report/project_issue_report_view.xml | 5 ++++ 18 files changed, 135 insertions(+), 75 deletions(-) diff --git a/addons/base_status/base_stage.py b/addons/base_status/base_stage.py index feb3fe59b75..418c927fc0b 100644 --- a/addons/base_status/base_stage.py +++ b/addons/base_status/base_stage.py @@ -199,3 +199,29 @@ class base_stage(object): raise osv.except_osv(_('Error!'), _("You are already at the top level of your sales-team category.\nTherefore you cannot escalate furthermore.")) self.write(cr, uid, [case.id], data, context=context) return True + + def case_set(self, cr, uid, ids, new_state_name=None, values_to_update=None, new_stage_id=None, context=None): + """ Generic method for setting case. This methods wraps the update + of the record. + + :params new_state_name: the new state of the record; this method + will call ``stage_set_with_state_name`` + that will find the stage matching the + new state, using the ``stage_find`` method. + :params new_stage_id: alternatively, you may directly give the + new stage of the record + :params state_name: the new value of the state, such as + 'draft' or 'close'. + :params update_values: values that will be added with the state + update when writing values to the record. + """ + cases = self.browse(cr, uid, ids, context=context) + # 1. update the stage + if new_state_name: + self.stage_set_with_state_name(cr, uid, cases, new_state_name, context=context) + elif not (new_stage_id is None): + self.stage_set(cr, uid, ids, new_stage_id, context=context) + # 2. update values + if values_to_update: + self.write(cr, uid, ids, values_to_update, context=context) + return True diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index aa989f3a393..ab948cc6035 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -413,10 +413,9 @@ class crm_lead(base_stage, format_address, osv.osv): if stage_id: self.case_set(cr, uid, [lead.id], new_stage_id=stage_id, context=context) else: - raise self.pool.get('res.config.settings').get_config_warning(cr, - _("To relieve your sales pipe and group all Lost opportunities, configure one of your sales stage as follow:\n" - "probability = 0, sequence != 1 and on_change = True.\n" - "You can create a specific column or edit an existing one from the menu %(menu:crm.menu_crm_case_section_act)s"), context=context) + raise osv.except_osv(_('Warning!'), _('To relieve your sales pipe and group all Lost opportunities, configure one of your sales stage as follow:\n' + 'probability = 0 %, select "Change Probability Automatically".\n' + 'Create a specific stage or edit an existing one by editing columns of your opportunity pipe.')) return True def case_mark_won(self, cr, uid, ids, context=None): @@ -426,10 +425,9 @@ class crm_lead(base_stage, format_address, osv.osv): if stage_id: self.case_set(cr, uid, [lead.id], new_stage_id=stage_id, context=context) else: - raise self.pool.get('res.config.settings').get_config_warning(cr, - _("To relieve your sales pipe and group all Won opportunities, configure one of your sales stage as follow:\n" - "probability = 100 and on_change = True.\n" - "You can create a specific column or edit an existing one from the menu %(menu:crm.menu_crm_case_section_act)s"), context=context) + raise osv.except_osv(_('Warning!'), _('To relieve your sales pipe and group all Won opportunities, configure one of your sales stage as follow:\n' + 'probability = 100 % and select "Change Probability Automatically".\n' + 'Create a specific stage or edit an existing one by editing columns of your opportunity pipe.')) return True def set_priority(self, cr, uid, ids, priority): diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index fa78284b15e..20097b2adee 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -328,7 +328,7 @@ - + @@ -378,7 +378,7 @@