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 @@
+ domain="['&', ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"/>
@@ -524,6 +524,7 @@
+
@@ -567,6 +568,8 @@
+
diff --git a/addons/crm_partner_assign/crm_lead_view.xml b/addons/crm_partner_assign/crm_lead_view.xml
index 0d2837d6ca5..643966324c8 100644
--- a/addons/crm_partner_assign/crm_lead_view.xml
+++ b/addons/crm_partner_assign/crm_lead_view.xml
@@ -43,6 +43,7 @@
+
@@ -54,6 +55,9 @@
+
+
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 5e86a82c6b4..68b18bdfbad 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -407,7 +407,6 @@ class hr_applicant(base_stage, osv.Model):
'department_id': applicant.department_id.id
})
self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context)
- self.case_close(cr, uid, [applicant.id], context)
else:
raise osv.except_osv(_('Warning!'), _('You must define an Applied Job and a Contact Name for this applicant.'))
@@ -439,6 +438,12 @@ class hr_applicant(base_stage, osv.Model):
context['empty_list_help_document_name'] = _("job applicants")
return super(hr_applicant, self).get_empty_list_help(cr, uid, help, context=context)
+ def write(self, cr, uid, ids, vals, context=None):
+ if 'stage_id' in vals:
+ vals['date_closed'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
+ result = super(hr_applicant, self).write(cr, uid, ids, vals, context=context)
+ return result
+
class hr_job(osv.osv):
_inherit = "hr.job"
diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml
index 3530749a5eb..0d6921af3c8 100644
--- a/addons/hr_recruitment/hr_recruitment_data.xml
+++ b/addons/hr_recruitment/hr_recruitment_data.xml
@@ -467,17 +467,11 @@
Stage changed
-
- Applicant Hired
+
+ Application Assignedhr.applicant
- Applicant hired
-
-
- Applicant Refused
- hr.applicant
-
- Applicant refused
+ Application Assigned
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index e78a8182ba9..c12fc9bf66f 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -58,6 +58,7 @@
+
@@ -195,6 +196,7 @@
+
diff --git a/addons/hr_recruitment/report/hr_recruitment_report.py b/addons/hr_recruitment/report/hr_recruitment_report.py
index 554d2a4bc85..67a1c725893 100644
--- a/addons/hr_recruitment/report/hr_recruitment_report.py
+++ b/addons/hr_recruitment/report/hr_recruitment_report.py
@@ -83,7 +83,7 @@ class hr_recruitment_report(osv.osv):
(sum(salary_proposed)/count(*)) as salary_prop_avg,
sum(salary_expected) as salary_exp,
(sum(salary_expected)/count(*)) as salary_exp_avg,
- extract('epoch' from (s.write_date-s.create_date))/(3600*24) as delay_close,
+ extract('epoch' from (s.date_closed-s.create_date))/(3600*24) as delay_close,
count(*) as nbr
from hr_applicant s
group by
diff --git a/addons/project/project.py b/addons/project/project.py
index f1da858932d..ce56343b5da 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -567,7 +567,8 @@ class task(base_stage, osv.osv):
_track = {
'stage_id': {
- 'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj
+ 'project.mt_task_new': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence == 1,
+ 'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj.stage_id.sequence != 1,
},
'kanban_state': { # kanban state: tracked, but only block subtype
'project.mt_task_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked',
@@ -678,7 +679,7 @@ class task(base_stage, osv.osv):
return {}
def onchange_user_assigned(self, cr, uid, ids, context=None):
- return {'value':{'date_start': fields.datetime.now(),'date_end':False}}
+ return {'value':{'date_start': time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT),'date_end':False}}
def duplicate_task(self, cr, uid, map_ids, context=None):
for new in map_ids.values():
@@ -1058,6 +1059,7 @@ class task(base_stage, osv.osv):
action=self.pool.get('project.task.type').read(cr, uid, new_stage, ['action'],context=context)
if action['action']:
self._trigger_stage_action(cr, uid, ids, action, context)
+ vals['date_end'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
vals_reset_kstate = dict(vals, kanban_state='normal')
for t in self.browse(cr, uid, ids, context=context):
#TO FIX:Kanban view doesn't raise warning
diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml
index 90e2df9d71a..119a4dacfa6 100644
--- a/addons/project/project_data.xml
+++ b/addons/project/project_data.xml
@@ -86,11 +86,11 @@
Task created
-
- Task Started
+
+ Task Assignedproject.task
- Task started
+ Task AssignedTask Blocked
@@ -98,12 +98,6 @@
Task blocked
-
- Task Done
- project.task
-
- Task closed
- Stage Changedproject.task
@@ -118,11 +112,11 @@
project_id
-
- Task Started
+
+ Task Assignedproject.project
-
+ project_id
@@ -131,12 +125,6 @@
project_id
-
- Task Done
- project.project
-
- project_id
- Task Stage Changedproject.project
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 163dccc3d71..f2d03c64d4c 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -34,6 +34,7 @@
+
diff --git a/addons/project/report/project_report.py b/addons/project/report/project_report.py
index 824c83b7a4c..59aa5b98fb9 100644
--- a/addons/project/report/project_report.py
+++ b/addons/project/report/project_report.py
@@ -22,6 +22,21 @@
from openerp.osv import fields,osv
from openerp import tools
+MONTHS = [
+ ('01', 'January'),
+ ('02', 'February'),
+ ('03', 'March'),
+ ('04', 'April'),
+ ('05', 'May'),
+ ('06', 'June'),
+ ('07', 'July'),
+ ('08', 'August'),
+ ('09', 'September'),
+ ('10', 'October'),
+ ('11', 'November'),
+ ('12', 'December')
+]
+
class report_project_task_user(osv.osv):
_name = "report.project.task.user"
_description = "Tasks by user and project"
@@ -44,15 +59,17 @@ class report_project_task_user(osv.osv):
'total_hours': fields.float('Total Hours', readonly=True),
'closing_days': fields.float('Days to Close', digits=(16,2), readonly=True, group_operator="avg",
help="Number of Days to close the task"),
- 'opening_days': fields.float('Days to Open', digits=(16,2), readonly=True, group_operator="avg",
- help="Number of Days to Open the task"),
+ 'opening_days': fields.float('Delay to Assign', digits=(16,2), readonly=True, group_operator="avg",
+ help="Number of Delay to Assign the task"),
'delay_endings_days': fields.float('Overpassed Deadline', digits=(16,2), readonly=True),
'nbr': fields.integer('# of tasks', readonly=True),
'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'),
('0','Very urgent')], 'Priority', readonly=True),
- 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
+ 'month':fields.selection(MONTHS, 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'partner_id': fields.many2one('res.partner', 'Contact', readonly=True),
+ 'update_month': fields.selection(MONTHS,'Last Update', readonly=True),
+ 'stage_id': fields.many2one('project.task.type', 'Stage'),
}
_order = 'name desc, project_id'
@@ -65,6 +82,7 @@ class report_project_task_user(osv.osv):
t.id as id,
to_char(date_start, 'YYYY') as year,
to_char(date_start, 'MM') as month,
+ to_char(date_end, 'MM') as update_month,
to_char(date_start, 'YYYY-MM-DD') as day,
date_trunc('day',t.date_start) as date_start,
date_trunc('day',t.date_end) as date_end,
diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml
index f3ce05b2a2f..1e4a508c224 100644
--- a/addons/project/report/project_report_view.xml
+++ b/addons/project/report/project_report_view.xml
@@ -33,6 +33,8 @@
+
+
@@ -72,6 +74,9 @@
+
+
+
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index c2e842bfcaa..d5bd4e24b8a 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -50,7 +50,8 @@ class project_issue(base_stage, osv.osv):
_track = {
'stage_id': {
- 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None: obj,
+ 'project_issue.mt_issue_new': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence == 1,
+ 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None:obj.stage_id.sequence != 1,
},
'kanban_state': {
'project_issue.mt_issue_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked',
@@ -65,6 +66,8 @@ class project_issue(base_stage, osv.osv):
if vals.get('project_id'):
ctx['default_project_id'] = vals['project_id']
vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
+ if vals.get('user_id'):
+ vals['date_open'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
# context: no_log, because subtype already handle this
create_context = dict(context, mail_create_nolog=True)
return super(project_issue, self).create(cr, uid, vals, context=create_context)
@@ -383,12 +386,10 @@ class project_issue(base_stage, osv.osv):
vals['date_action_last'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
for issue in self.browse(cr, uid, ids, context=context):
# Change from draft to not draft EXCEPT cancelled: The issue has been opened -> set the opening date
+ vals['date_closed'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
if stage['sequence'] == 1:
vals['date_open'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
- # Change from not done to done: The issue has been closed -> set the closing date
- sequence = [stage.sequence for stage in issue.project_id.type_ids[-2:]]
- if stage['sequence'] in sequence:
- vals['date_closed'] = time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
+ vals['date_closed'] = False
return super(project_issue, self).write(cr, uid, ids, vals, context)
def onchange_task_id(self, cr, uid, ids, task_id, context=None):
@@ -564,6 +565,8 @@ class project_issue(base_stage, osv.osv):
self.write(cr, SUPERUSER_ID, thread_id, {'date_action_last': time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)}, context=context)
return res
+ def onchange_user_assigned(self, cr, uid, ids, context=None):
+ return self.write(cr,uid,ids,{'date_open': time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT),'date_close':False},context)
class project(osv.Model):
_inherit = "project.project"
diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml
index 2e43ca69193..5d126e01b45 100644
--- a/addons/project_issue/project_issue_data.xml
+++ b/addons/project_issue/project_issue_data.xml
@@ -35,11 +35,11 @@ Access all issues from the top Project menu, and access the issues of a specific
Issue created
-
- Issue Started
+
+ Issue Assignedproject.issue
- Issue started
+ Issue AssignedIssue Blocked
@@ -47,12 +47,6 @@ Access all issues from the top Project menu, and access the issues of a specific
Issue blocked
-
- Issue Closed
- project.issue
-
- Issue closed
- Stage Changedproject.issue
@@ -67,11 +61,11 @@ Access all issues from the top Project menu, and access the issues of a specific
project_id
-
- Issue Started
+
+ Issue Assignedproject.project
-
+ project_id
@@ -80,12 +74,6 @@ Access all issues from the top Project menu, and access the issues of a specific
project_id
-
- Issue Closed
- project.project
-
- project_id
- Issue Stage Changedproject.project
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index a7704bba4c9..16f463a92ac 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -64,7 +64,8 @@
+ context="{'default_groups_ref': ['base.group_user', 'project.group_project_user']}"
+ on_change="onchange_user_assigned()"/>
@@ -130,6 +131,8 @@
+
+
@@ -152,6 +155,8 @@
+
+
diff --git a/addons/project_issue/report/project_issue_report.py b/addons/project_issue/report/project_issue_report.py
index e57a21996d3..7e905ae8f29 100644
--- a/addons/project_issue/report/project_issue_report.py
+++ b/addons/project_issue/report/project_issue_report.py
@@ -24,6 +24,20 @@ from openerp.osv import fields,osv
from openerp import tools
from openerp.addons.crm import crm
+MONTHS = [
+ ('01', 'January'),
+ ('02', 'February'),
+ ('03', 'March'),
+ ('04', 'April'),
+ ('05', 'May'),
+ ('06', 'June'),
+ ('07', 'July'),
+ ('08', 'August'),
+ ('09', 'September'),
+ ('10', 'October'),
+ ('11', 'November'),
+ ('12', 'December')
+]
class project_issue_report(osv.osv):
_name = "project.issue.report"
@@ -32,12 +46,7 @@ class project_issue_report(osv.osv):
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'section_id':fields.many2one('crm.case.section', 'Sale Team', readonly=True),
- 'month':fields.selection([('01', 'January'), ('02', 'February'), \
- ('03', 'March'), ('04', 'April'),\
- ('05', 'May'), ('06', 'June'), \
- ('07', 'July'), ('08', 'August'),\
- ('09', 'September'), ('10', 'October'),\
- ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
+ 'month':fields.selection(MONTHS, 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'opening_date': fields.date('Date of Opening', readonly=True),
@@ -56,6 +65,8 @@ class project_issue_report(osv.osv):
'project_id':fields.many2one('project.project', 'Project',readonly=True),
'version_id': fields.many2one('project.issue.version', 'Version'),
'user_id' : fields.many2one('res.users', 'Assigned to',readonly=True),
+ 'assign_month':fields.selection(MONTHS, 'Assigned Month', readonly=True),
+ 'update_month': fields.selection(MONTHS,'Last Update', readonly=True),
'partner_id': fields.many2one('res.partner','Contact'),
'channel_id': fields.many2one('crm.case.channel', 'Channel',readonly=True),
'task_id': fields.many2one('project.task', 'Task'),
@@ -74,6 +85,8 @@ class project_issue_report(osv.osv):
to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
to_char(c.create_date, 'YYYY-MM-DD') as creation_date,
c.user_id,
+ to_char(c.date_open, 'MM') as assign_month,
+ to_char(c.date_closed, 'MM') as update_month,
c.working_hours_open,
c.working_hours_close,
c.section_id,
@@ -89,7 +102,7 @@ class project_issue_report(osv.osv):
c.task_id,
date_trunc('day',c.create_date) as create_date,
c.day_open as delay_open,
- c.write_date as delay_close,
+ c.day_close as delay_close,
(SELECT count(id) FROM mail_message WHERE model='project.issue' AND res_id=c.id) AS email
FROM
diff --git a/addons/project_issue/report/project_issue_report_view.xml b/addons/project_issue/report/project_issue_report_view.xml
index 304617552d8..d6b02a09e56 100644
--- a/addons/project_issue/report/project_issue_report_view.xml
+++ b/addons/project_issue/report/project_issue_report_view.xml
@@ -16,6 +16,8 @@
+
+
@@ -51,8 +53,11 @@
+
+
+