diff --git a/addons/project/__openerp__.py b/addons/project/__openerp__.py
index 03b72e09e38..c3784c457b1 100644
--- a/addons/project/__openerp__.py
+++ b/addons/project/__openerp__.py
@@ -21,12 +21,12 @@
{
- "name" : "Project Management",
+ "name": "Project Management",
"version": "1.1",
- "author" : "Tiny",
- "website" : "http://www.openerp.com",
- "category" : "Generic Modules/Projects & Services",
- "depends" : ["product", "analytic", "process", "mail_gateway","board"],
+ "author": "Tiny",
+ "website": "http://www.openerp.com",
+ "category": "Generic Modules/Projects & Services",
+ "depends": ["product", "analytic", "process", "mail_gateway","board"],
"description": """Project management module that track multi-level projects, tasks,
work done on tasks, eso. It is able to render planning, order tasks, eso.
Dashboard for project members that includes:
@@ -35,7 +35,7 @@ work done on tasks, eso. It is able to render planning, order tasks, eso.
* Members list of project
* Issues
""",
- "init_xml" : [],
+ "init_xml": [],
"update_xml": [
"security/project_security.xml",
"wizard/project_task_delegate_view.xml",
diff --git a/addons/project/board_project_manager_view.xml b/addons/project/board_project_manager_view.xml
index 3c32361e5ec..f62c292e779 100644
--- a/addons/project/board_project_manager_view.xml
+++ b/addons/project/board_project_manager_view.xml
@@ -21,8 +21,6 @@
-
-
board.project.manager.form
board.board
diff --git a/addons/project/company.py b/addons/project/company.py
index f745739bf60..f0e66e468b4 100644
--- a/addons/project/company.py
+++ b/addons/project/company.py
@@ -28,9 +28,9 @@ class res_company(osv.osv):
help='This will set the unit of measure used in projects and tasks.\n' \
"If you use the timesheet linked to projects (project_timesheet module), don't " \
"forget to setup the right unit of measure in your employees.",
-
),
}
+
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project/installer.py b/addons/project/installer.py
index dd18a2937a2..e35e1b72a6c 100644
--- a/addons/project/installer.py
+++ b/addons/project/installer.py
@@ -26,29 +26,29 @@ class project_installer(osv.osv_memory):
_columns = {
# Project Management
- 'project_long_term':fields.boolean('Long Term Planning',
+ 'project_long_term': fields.boolean('Long Term Planning',
help="Enables long-term projects tracking, including "
"multiple-phase projects and resource allocation handling."),
- 'project_wiki':fields.boolean('Specifications in a Wiki',
+ 'project_wiki': fields.boolean('Specifications in a Wiki',
help=""),
- 'hr_timesheet_sheet':fields.boolean('Timesheets',
+ 'hr_timesheet_sheet': fields.boolean('Timesheets',
help="Tracks and helps employees encode and validate timesheets "
"and attendance."),
- 'hr_timesheet_invoice':fields.boolean('Invoice Based on Hours',
+ 'hr_timesheet_invoice': fields.boolean('Invoice Based on Hours',
help="Helps generate invoice based on based on human resources "
"costs and general expenses."),
- 'account_budget':fields.boolean('Budgets',
+ 'account_budget': fields.boolean('Budgets',
help="Helps accountants manage analytic and crossover budgets."),
- 'project_messages':fields.boolean('Project Messages',
+ 'project_messages': fields.boolean('Project Messages',
help="Lets employees send messages to other members of the "
"projects they're working on."),
- 'project_crm':fields.boolean('Issues Tracker',
+ 'project_crm': fields.boolean('Issues Tracker',
help="Automatically synchronizes project tasks and crm cases."),
# Methodologies
- 'scrum':fields.boolean('SCRUM',
+ 'scrum': fields.boolean('SCRUM',
help="Implements and tracks the concepts and task types defined "
"in the SCRUM methodology."),
- 'project_gtd':fields.boolean('Getting Things Done',
+ 'project_gtd': fields.boolean('Getting Things Done',
help="Embeds the Getting Things Done concepts into OpenERP's "
"project management."),
}
@@ -56,3 +56,5 @@ class project_installer(osv.osv_memory):
'project_crm': True,
}
project_installer()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/project/project.py b/addons/project/project.py
index 07349e81c4d..169a2043b20 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -19,7 +19,6 @@
#
##############################################################################
from lxml import etree
-import mx.DateTime
import datetime
import time
@@ -37,7 +36,7 @@ class project_task_type(osv.osv):
_order = 'sequence'
_defaults = {
- 'sequence': lambda *args: 1
+ 'sequence': 1
}
project_task_type()
@@ -61,7 +60,9 @@ class project(osv.osv):
return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order,
context=context, count=count)
- def _complete_name(self, cr, uid, ids, name, args, context={}):
+ def _complete_name(self, cr, uid, ids, name, args, context=None):
+ if context is None:
+ context = {}
res = {}
for m in self.browse(cr, uid, ids, context=context):
res[m.id] = (m.parent_id and (m.parent_id.name + '/') or '') + m.name
@@ -71,7 +72,9 @@ class project(osv.osv):
return super(project, self).check_recursion(cursor, user, ids,
parent=parent)
- def onchange_partner_id(self, cr, uid, ids, part, context={}):
+ def onchange_partner_id(self, cr, uid, ids, part=False, context=None):
+ if context is None:
+ context = {}
partner_obj = self.pool.get('res.partner')
if not part:
return {'value':{'contact_id': False, 'pricelist_id': False}}
@@ -80,7 +83,9 @@ class project(osv.osv):
pricelist_id = pricelist.get('property_product_pricelist', False) and pricelist.get('property_product_pricelist')[0] or False
return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist_id}}
- def _progress_rate(self, cr, uid, ids, names, arg, context={}):
+ def _progress_rate(self, cr, uid, ids, names, arg, context=None):
+ if context is None:
+ context = {}
res = {}.fromkeys(ids, 0.0)
progress = {}
if not ids:
@@ -118,11 +123,12 @@ class project(osv.osv):
if proj.tasks:
raise osv.except_osv(_('Operation Not Permitted !'), _('You can not delete a project with tasks. I suggest you to deactivate it.'))
return super(project, self).unlink(cr, uid, ids, *args, **kwargs)
+
_columns = {
'complete_name': fields.function(_complete_name, method=True, string="Project Name", type='char', size=250),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the project without removing it."),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of Projects."),
- 'category_id': fields.many2one('account.analytic.account','Analytic Account', 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."),
+ 'category_id': fields.many2one('account.analytic.account', 'Analytic Account', 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."),
'priority': fields.integer('Sequence', help="Gives the sequence order when displaying a list of task"),
'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team."),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose."),
@@ -135,17 +141,17 @@ class project(osv.osv):
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed."),
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed."),
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages'),
- '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.'),
+ '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.'),
}
_order = "sequence"
_defaults = {
- 'active': lambda *a: True,
- 'priority': lambda *a: 1,
- 'sequence': lambda *a: 10,
- 'warn_manager': lambda *a: True,
+ 'active': True,
+ 'priority': 1,
+ 'sequence': 10,
+ 'warn_manager': True,
}
def _check_dates(self, cr, uid, ids):
- leave = self.read(cr, uid, ids[0],['date_start','date'])
+ leave = self.read(cr, uid, ids[0], ['date_start', 'date'])
if leave['date_start'] and leave['date']:
if leave['date_start'] > leave['date']:
return False
@@ -162,31 +168,33 @@ class project(osv.osv):
(_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date']),
(_check_escalation, 'Error! You cannot assign escalation to the same project!', ['project_escalation_id'])
]
- def set_template(self, cr, uid, ids, context={}):
+ def set_template(self, cr, uid, ids, context=None):
res = self.setActive(cr, uid, ids, value=False, context=context)
return res
- def set_done(self, cr, uid, ids, context={}):
+ def set_done(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'close'}, context=context)
return True
- def set_cancel(self, cr, uid, ids, context={}):
+ def set_cancel(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'cancelled'}, context=context)
return True
- def set_pending(self, cr, uid, ids, context={}):
+ def set_pending(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'pending'}, context=context)
return True
- def set_open(self, cr, uid, ids, context={}):
+ def set_open(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state':'open'}, context=context)
return True
- def reset_project(self, cr, uid, ids, context={}):
- res = self.setActive(cr, uid, ids,value=True, context=context)
+ def reset_project(self, cr, uid, ids, context=None):
+ res = self.setActive(cr, uid, ids, value=True, context=context)
return res
- def copy(self, cr, uid, id, default={}, context={}):
+ def copy(self, cr, uid, id, default={}, context=None):
+ if context is None:
+ context = {}
proj = self.browse(cr, uid, id, context=context)
default = default or {}
context['active_test'] = False
@@ -199,13 +207,15 @@ class project(osv.osv):
cr.execute('update project_task set active=True where project_id IN %s',(tuple(ids),))
return res
- def duplicate_template(self, cr, uid, ids, context={}):
+ def duplicate_template(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
project_obj = self.pool.get('project.project')
data_obj = self.pool.get('ir.model.data')
task_obj = self.pool.get('project.task')
result = []
for proj in self.browse(cr, uid, ids, context=context):
- parent_id = context.get('parent_id',False) # check me where to pass context for parent id ??
+ parent_id = context.get('parent_id', False) # check me where to pass context for parent id ??
context.update({'analytic_project_copy': True})
new_id = project_obj.copy(cr, uid, proj.id, default = {
'name': proj.name +_(' (copy)'),
@@ -233,7 +243,7 @@ class project(osv.osv):
'view_mode': 'form,tree',
'res_model': 'project.project',
'view_id': False,
- 'res_id' : res_id,
+ 'res_id': res_id,
'views': [(form_view['res_id'],'form'),(tree_view['res_id'],'tree')],
'type': 'ir.actions.act_window',
'search_view_id': search_view['res_id'],
@@ -242,9 +252,13 @@ class project(osv.osv):
# return result
# set active value for a project, its sub projects and its tasks
- def setActive(self, cr, uid, ids, value=True, context={}):
+ def setActive(self, cr, uid, ids, value=True, context=None):
+ if context is None:
+ context = {}
task_obj = self.pool.get('project.task')
- for proj in self.browse(cr, uid, ids, context):
+ for proj in self.browse(cr, uid, ids, context=None):
+ if context is None:
+ context = {}
self.write(cr, uid, [proj.id], {'state': value and 'open' or 'template'}, context)
cr.execute('select id from project_task where project_id=%s', (proj.id,))
tasks_id = [x[0] for x in cr.fetchall()]
@@ -252,7 +266,9 @@ class project(osv.osv):
task_obj.write(cr, uid, tasks_id, {'active': value}, context=context)
child_ids = self.search(cr, uid, [('parent_id','=', proj.id)])
if child_ids:
- self.setActive(cr, uid, child_ids, value, context)
+ self.setActive(cr, uid, child_ids, value, context=None)
+ if context is None:
+ context = {}
return True
project()
@@ -262,13 +278,17 @@ class task(osv.osv):
_log_create = True
_date_name = "date_start"
- def _str_get(self, task, level=0, border='***', context={}):
+ def _str_get(self, task, level=0, border='***', context=None):
+ if context is None:
+ context = {}
return border+' '+(task.user_id and task.user_id.name.upper() or '')+(level and (': L'+str(level)) or '')+(' - %.1fh / %.1fh'%(task.effective_hours or 0.0,task.planned_hours))+' '+border+'\n'+ \
border[0]+' '+(task.name or '')+'\n'+ \
(task.description or '')+'\n\n'
# Compute: effective_hours, total_hours, progress
def _hours_get(self, cr, uid, ids, field_names, args, context=None):
+ if context is None:
+ context = {}
res = {}
cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id IN %s GROUP BY task_id",(tuple(ids),))
hours = dict(cr.fetchall())
@@ -277,17 +297,17 @@ class task(osv.osv):
res[task.id]['progress'] = 0.0
if (task.remaining_hours + hours.get(task.id, 0.0)):
if task.state != 'done':
- res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99),2)
+ res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99), 2)
- if task.state in ('done','cancel'):
+ if task.state in ('done', 'cancel'):
res[task.id]['progress'] = 100.0
res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours
return res
def onchange_planned(self, cr, uid, ids, planned = 0.0, effective = 0.0):
- return {'value':{'remaining_hours' : planned - effective}}
+ return {'value':{'remaining_hours': planned - effective}}
- def _default_project(self, cr, uid, context={}):
+ def _default_project(self, cr, uid, context=None):
if 'project_id' in context and context['project_id']:
return int(context['project_id'])
return False
@@ -296,17 +316,21 @@ class task(osv.osv):
# ('remaining_hours', 'CHECK (remaining_hours>=0)', 'Please increase and review remaining hours ! It can not be smaller than 0.'),
#]
- def copy_data(self, cr, uid, id, default={},context={}):
+ def copy_data(self, cr, uid, id, default={}, context=None):
+ if context is None:
+ context = {}
default = default or {}
default['work_ids'] = []
return super(task, self).copy_data(cr, uid, id, default, context)
- def _check_dates(self, cr, uid, ids, context={}):
- task = self.read(cr, uid, ids[0],['date_start', 'date_end'])
- if task['date_start'] and task['date_end']:
+ def _check_dates(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ task = self.read(cr, uid, ids[0], ['date_start', 'date_end'])
+ if task['date_start'] and task['date_end']:
if task['date_start'] > task['date_end']:
return False
- return True
+ return True
_columns = {
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the task without removing it."),
@@ -334,19 +358,19 @@ class task(osv.osv):
'delay_hours': fields.function(_hours_get, method=True, string='Delay Hours', multi='hours', store=True, help="Computed as difference of the time estimated by the project manager and the real time to close the task."),
'user_id': fields.many2one('res.users', 'Assigned to'),
- 'delegated_user_id': fields.related('child_ids','user_id',type='many2one', relation='res.users', string='Delegated To'),
+ 'delegated_user_id': fields.related('child_ids', 'user_id', type='many2one', relation='res.users', string='Delegated To'),
'partner_id': fields.many2one('res.partner', 'Partner'),
'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'),
- 'manager_id': fields.related('project_id','category_id','user_id', type='many2one', relation='res.users', string='Project Manager'),
+ 'manager_id': fields.related('project_id', 'category_id', 'user_id', type='many2one', relation='res.users', string='Project Manager'),
'company_id': fields.many2one('res.company', 'Company'),
}
_defaults = {
- 'state': lambda *a: 'draft',
- 'priority': lambda *a: '2',
- 'progress': lambda *a: 0,
- 'sequence': lambda *a: 10,
- 'active': lambda *a: True,
- 'date_start': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
+ 'state': 'draft',
+ 'priority': '2',
+ 'progress': 0,
+ 'sequence': 10,
+ 'active': True,
+ 'date_start': time.strftime('%Y-%m-%d %H:%M:%S'),
'project_id': _default_project,
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=c)
}
@@ -360,6 +384,8 @@ class task(osv.osv):
#
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
users_obj = self.pool.get('res.users')
+ if context is None:
+ context = {}
obj_tm = users_obj.browse(cr, uid, uid, context).company_id.project_time_mode_id
tm = obj_tm and obj_tm.name or 'Hours'
@@ -519,11 +545,11 @@ class project_work(osv.osv):
'task_id': fields.many2one('project.task', 'Task', ondelete='cascade', required=True),
'hours': fields.float('Time Spent'),
'user_id': fields.many2one('res.users', 'Done by', required=True),
- 'company_id': fields.related('task_id','company_id',type='many2one',relation='res.company',string='Company',store=True)
+ 'company_id': fields.related('task_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True)
}
_defaults = {
'user_id': lambda obj, cr, uid, context: uid,
- 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S')
+ 'date': time.strftime('%Y-%m-%d %H:%M:%S')
}
_order = "date desc"
def create(self, cr, uid, vals, *args, **kwargs):
@@ -533,7 +559,9 @@ class project_work(osv.osv):
cr.execute('update project_task set remaining_hours=remaining_hours - %s where id=%s', (vals.get('hours',0.0), vals['task_id']))
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
- def write(self, cr, uid, ids,vals,context={}):
+ def write(self, cr, uid, ids, vals, context=None):
+ if context is None:
+ context = {}
if 'hours' in vals and (not vals['hours']):
vals['hours'] = 0.00
if 'hours' in vals:
@@ -544,7 +572,7 @@ class project_work(osv.osv):
def unlink(self, cr, uid, ids, *args, **kwargs):
for work in self.browse(cr, uid, ids):
cr.execute('update project_task set remaining_hours=remaining_hours + %s where id=%s', (work.hours, work.task_id.id))
- return super(project_work,self).unlink(cr, uid, ids,*args, **kwargs)
+ return super(project_work,self).unlink(cr, uid, ids, *args, **kwargs)
project_work()
class config_compute_remaining(osv.osv_memory):
@@ -552,7 +580,7 @@ class config_compute_remaining(osv.osv_memory):
def _get_remaining(self,cr, uid, ctx):
task_obj = self.pool.get('project.task')
if 'active_id' in ctx:
- return task_obj.browse(cr,uid,ctx['active_id'],context=ctx).remaining_hours
+ return task_obj.browse(cr, uid, ctx['active_id'], context=ctx).remaining_hours
return False
_columns = {
@@ -603,15 +631,17 @@ class message(osv.osv):
'description': fields.text('Description'),
}
- def _default_project(self, cr, uid, context={}):
+ def _default_project(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'project_id' in context and context['project_id']:
return int(context['project_id'])
return False
_defaults = {
- 'user_id' : lambda self,cr,uid,ctx : uid,
- 'date' : lambda self,cr,uid,ctx : time.strftime('%Y-%m-%d'),
- 'project_id':_default_project
+ 'user_id': lambda self,cr,uid,ctx: uid,
+ 'date': lambda self,cr,uid,ctx: time.strftime('%Y-%m-%d'),
+ 'project_id': _default_project
}
message()
@@ -637,4 +667,5 @@ class account_analytic_account(osv.osv):
return super(account_analytic_account, self).create(cr, uid, vals, context=context)
account_analytic_account()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml
index 2addd68fa19..a931c96f635 100644
--- a/addons/project/project_data.xml
+++ b/addons/project/project_data.xml
@@ -8,9 +8,11 @@
Project
project.project
+
Project task
project.task
+
diff --git a/addons/project/project_installer.xml b/addons/project/project_installer.xml
index f7c46066178..12510f8b944 100644
--- a/addons/project/project_installer.xml
+++ b/addons/project/project_installer.xml
@@ -10,10 +10,8 @@
-
- Project Management
+ Project Management
@@ -55,6 +53,7 @@
3
+
ir.actions.todo
project_installer_action_replace
diff --git a/addons/project/project_mailgate.py b/addons/project/project_mailgate.py
index 5409aa4e752..b057c98b03d 100644
--- a/addons/project/project_mailgate.py
+++ b/addons/project/project_mailgate.py
@@ -77,7 +77,9 @@ class project_tasks(osv.osv):
getattr(self,act)(cr, uid, [id])
return True
- def message_followers(self, cr, uid, ids, context={}):
+ def message_followers(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
res = []
if isinstance(ids, (str, int, long)):
select = [ids]
diff --git a/addons/project/project_resource.py b/addons/project/project_resource.py
index 478fd4316bc..8ff68c94ea8 100644
--- a/addons/project/project_resource.py
+++ b/addons/project/project_resource.py
@@ -1,9 +1,10 @@
import pooler
import datetime
-def timeformat_convert(cr, uid, time_string, context={}):
+def timeformat_convert(cr, uid, time_string, context=None):
# Function to convert input time string:: 8.5 to output time string 8:30
-
+ if context is None:
+ context = {}
split_list = str(time_string).split('.')
hour_part = split_list[0]
mins_part = split_list[1]
@@ -78,4 +79,4 @@ def compute_working_calendar(cr,uid,calendar_id):
if non_working:
wktime_cal.append((non_working[:-1],time_range))
- return wktime_cal
\ No newline at end of file
+ return wktime_cal
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index ef7bb92d1d6..ad28bda6d6a 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -42,7 +42,6 @@
-
@@ -517,6 +516,7 @@
form
+
@@ -545,7 +545,6 @@
-
res.users.project.form1
diff --git a/addons/project/report/project_report.py b/addons/project/report/project_report.py
index ff8d2b2dfc1..fec1052b28b 100644
--- a/addons/project/report/project_report.py
+++ b/addons/project/report/project_report.py
@@ -29,14 +29,14 @@ class report_project_task_user(osv.osv):
_columns = {
'name': fields.char('Task Summary', size=128, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
- 'year': fields.char('Year',size=64,required=False, readonly=True),
- 'user_id':fields.many2one('res.users', 'Assigned To', readonly=True),
+ 'year': fields.char('Year', size=64, required=False, readonly=True),
+ 'user_id': fields.many2one('res.users', 'Assigned To', readonly=True),
'date_start': fields.date('Starting Date',readonly=True),
'no_of_days': fields.integer('# of Days', size=128, readonly=True),
- 'description': fields.text('Description',readonly=True),
- 'date_end': fields.date('Ending Date',readonly=True),
- 'date_deadline': fields.date('Deadline',readonly=True),
- 'project_id':fields.many2one('project.project', 'Project', readonly=True),
+ 'description': fields.text('Description', readonly=True),
+ 'date_end': fields.date('Ending Date', readonly=True),
+ 'date_deadline': fields.date('Deadline', readonly=True),
+ 'project_id': fields.many2one('project.project', 'Project', readonly=True),
'hours_planned': fields.float('Planned Hours', readonly=True),
'hours_effective': fields.float('Effective Hours', readonly=True),
'hours_delay': fields.float('Avg. Plan.-Eff.', readonly=True),
@@ -49,32 +49,21 @@ class report_project_task_user(osv.osv):
help="Number of Days to Open 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')],
- 'Importance',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),
- 'state': fields.selection([
- ('draft', 'Draft'),
- ('open', 'In Progress'),
- ('pending', 'Pending'),
- ('cancelled', 'Cancelled'),
- ('done', 'Done')],
- 'State', readonly=True),
- 'company_id': fields.many2one('res.company', 'Company',readonly=True, groups="base.group_multi_company"),
- 'partner_id': fields.many2one('res.partner', 'Partner',readonly=True),
- 'type': fields.many2one('project.task.type', 'Stage',readonly=True),
-
+ 'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'),
+('0','Very urgent')], 'Importance', 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),
+ 'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')],'State', readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company', readonly=True, groups="base.group_multi_company"),
+ 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
+ 'type': fields.many2one('project.task.type', 'Stage', readonly=True),
}
_order = 'name desc, project_id'
+
def init(self, cr):
tools.sql.drop_view_if_exists(cr, 'report_project_task_user')
cr.execute("""
- create view report_project_task_user as
- select
+ CREATE view report_project_task_user as
+ SELECT
(select 1 ) AS nbr,
t.id as id,
to_char(date_start, 'YYYY') as year,
@@ -102,9 +91,9 @@ class report_project_task_user(osv.osv):
(extract('epoch' from (t.date_end-t.create_date)))/(3600*24) as closing_days,
(extract('epoch' from (t.date_start-t.create_date)))/(3600*24) as opening_days,
(extract('epoch' from (t.date_deadline-t.date_end)))/(3600*24) as delay_endings_days
- from project_task t
+ FROM project_task t
- group by
+ GROUP BY
t.id,
remaining_hours,
t.effective_hours,
@@ -139,37 +128,38 @@ class project_vs_remaining_hours(osv.osv):
_columns = {
'project': fields.char('Project', size=128, required=True),
'remaining_hours': fields.float('Remaining Hours', readonly=True),
- 'state': fields.selection([('draft','Draft'),('open','Open'), ('pending','Pending'),('cancelled', 'Cancelled'),('close','Close'),('template', 'Template')], 'State', required=True,readonly=True)
+ 'state': fields.selection([('draft','Draft'),('open','Open'), ('pending','Pending'),('cancelled', 'Cancelled'),('close','Close'),('template', 'Template')], 'State', required=True, readonly=True)
}
_order = 'project desc'
+
def init(self, cr):
tools.sql.drop_view_if_exists(cr, 'project_vs_remaining_hours')
cr.execute("""
- create or replace view project_vs_remaining_hours as (
+ CREATE or REPLACE view project_vs_remaining_hours as (
select
min(pt.id) as id,
aaa.user_id as uid,
aaa.name as project,
aaa.state,
sum(pt.remaining_hours) as remaining_hours
- from project_project as pp,
+ FROM project_project as pp,
account_analytic_account as aaa,
project_task as pt
- where aaa.id=pp.category_id and pt.project_id=pp.id and pp.category_id=aaa.id
- group by aaa.user_id,aaa.state,aaa.name
+ WHERE aaa.id=pp.category_id and pt.project_id=pp.id and pp.category_id=aaa.id
+ GROUP BY aaa.user_id,aaa.state,aaa.name
UNION All
- select
+ SELECT
min(pt.id) as id,
pur.uid as uid,
aaa.name as project,
aaa.state,
sum(pt.remaining_hours) as remaining_hours
- from project_project as pp,
+ FROM project_project as pp,
project_user_rel as pur,
account_analytic_account as aaa,
project_task as pt
- where pur.project_id=pp.id and pt.project_id=pp.id and pp.category_id=aaa.id
- group by pur.uid,aaa.state,aaa.name
+ WHERE pur.project_id=pp.id and pt.project_id=pp.id and pp.category_id=aaa.id
+ GROUP BY pur.uid,aaa.state,aaa.name
)
""")
project_vs_remaining_hours()
@@ -182,22 +172,23 @@ class task_by_days(osv.osv):
'day': fields.char('Day', size=128, required=True),
'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True),
'total_task': fields.float('Total tasks', readonly=True),
- 'project_id':fields.many2one('project.project','Project')
+ 'project_id':fields.many2one('project.project', 'Project')
}
_order = 'day desc'
+
def init(self, cr):
tools.sql.drop_view_if_exists(cr, 'task_by_days')
cr.execute("""
- create or replace view task_by_days as (
- select
+ CREATE or REPLACE view task_by_days as (
+ SELECT
min(pt.id) as id,
to_char(pt.create_date, 'YYYY-MM-DD') as day,
count(*) as total_task,
pt.state as state,
pt.project_id
- from
+ FROM
project_task as pt
- group by
+ GROUP BY
to_char(pt.create_date, 'YYYY-MM-DD'),pt.state,pt.project_id
)
""")
diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml
index 48119f307e0..9df6bd1f8ab 100644
--- a/addons/project/report/project_report_view.xml
+++ b/addons/project/report/project_report_view.xml
@@ -86,13 +86,13 @@
icon="terp-dialog-close"
name="done"
domain="[('state','=','done')]"/>
-
+
-
+ help="My Projects" domain="[('project_id','=',uid)]"/>
+
-
+
@@ -144,6 +144,7 @@
{'search_default_month':1,'search_default_project':1,'group_by_no_leaf':1,'group_by':[]}
+
@@ -181,6 +182,7 @@
[('uid','=',uid)]
+
task.by.days.tree
diff --git a/addons/project/res_partner.py b/addons/project/res_partner.py
index f0297cf6a72..351f28cb283 100644
--- a/addons/project/res_partner.py
+++ b/addons/project/res_partner.py
@@ -22,11 +22,13 @@
from osv import fields,osv
class res_partner(osv.osv):
+
""" Inherits partner and adds CRM information in the partner form """
_inherit = 'res.partner'
_columns = {
'task_ids': fields.one2many('project.task', 'partner_id', 'Tasks'),
}
+
res_partner()
diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml
index dbb28db165e..6071e644f34 100644
--- a/addons/project/security/project_security.xml
+++ b/addons/project/security/project_security.xml
@@ -5,9 +5,11 @@
Project / Financial Manager
+
Project / Manager
+
Project / User
diff --git a/addons/project/wizard/project_close_task.py b/addons/project/wizard/project_close_task.py
index 00752606bd0..b1cd933a4f7 100644
--- a/addons/project/wizard/project_close_task.py
+++ b/addons/project/wizard/project_close_task.py
@@ -33,9 +33,11 @@ class project_close_task(osv.osv_memory):
_columns = {
'email': fields.char('E-Mail', size=64, help="Email Address"),
'description': fields.text('Description'),
- }
+ }
- def _get_email(self, cr, uid, context={}):
+ def _get_email(self, cr, uid, context=None):
+ if context is None:
+ context = {}
email = ''
if 'task_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['task_id'])
@@ -44,7 +46,9 @@ class project_close_task(osv.osv_memory):
email = partner_id.address[0].email
return email
- def _get_desc(self, cr, uid, context={}):
+ def _get_desc(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'task_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['task_id'])
return task.description or task.name
@@ -55,7 +59,9 @@ class project_close_task(osv.osv_memory):
'description': _get_desc,
}
- def confirm(self, cr, uid, ids, context={}):
+ def confirm(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
if not 'task_id' in context:
return {}
close_task = self.read(cr, uid, ids[0], [])
@@ -88,4 +94,4 @@ class project_close_task(osv.osv_memory):
return {}
project_close_task()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project/wizard/project_close_task_view.xml b/addons/project/wizard/project_close_task_view.xml
index b9bace0aaef..f9206152b25 100644
--- a/addons/project/wizard/project_close_task_view.xml
+++ b/addons/project/wizard/project_close_task_view.xml
@@ -11,10 +11,10 @@
-
-
-
-
+
+
+
+
@@ -36,4 +36,4 @@
-
\ No newline at end of file
+
diff --git a/addons/project/wizard/project_task_delegate.py b/addons/project/wizard/project_task_delegate.py
index adfddcd8fd9..30fc02f9ca3 100644
--- a/addons/project/wizard/project_task_delegate.py
+++ b/addons/project/wizard/project_task_delegate.py
@@ -33,12 +33,11 @@ class project_task_delegate(osv.osv_memory):
'new_task_description': fields.text('New Task Description', help="Reinclude the description of the task in the task of the user"),
'planned_hours': fields.float('Planned Hours', help="Estimated time to close this task by the delegated user"),
'planned_hours_me': fields.float('Hours to Validate', required=True, help="Estimated time for you to validate the work done by the user to whom you delegate this task"),
- 'state': fields.selection([('pending','Pending'),
- ('done','Done'),
- ],'Validation State', required=True, help="New state of your own task. Pending will be reopened automatically when the delegated task is closed"),
- }
+ 'state': fields.selection([('pending','Pending'), ('done','Done'), ], 'Validation State', required=True, help="New state of your own task. Pending will be reopened automatically when the delegated task is closed"), }
- def _get_name(self, cr, uid, context={}):
+ def _get_name(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['active_id'])
if task.name.startswith(_('CHECK: ')):
@@ -48,13 +47,17 @@ class project_task_delegate(osv.osv_memory):
return newname
return ''
- def _get_plan_hour(self, cr, uid, context={}):
+ def _get_plan_hour(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['active_id'])
return task.remaining_hours
return 0.0
- def _get_prefix(self, cr, uid, context={}):
+ def _get_prefix(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['active_id'])
if task.name.startswith(_('CHECK: ')):
@@ -64,7 +67,9 @@ class project_task_delegate(osv.osv_memory):
return _('CHECK: ')+ newname
return ''
- def _get_new_desc(self, cr, uid, context={}):
+ def _get_new_desc(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['active_id'])
return task.description
@@ -79,7 +84,9 @@ class project_task_delegate(osv.osv_memory):
'state': 'pending',
}
- def validate(self, cr, uid, ids, context={}):
+ def validate(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
task_obj = self.pool.get('project.task')
delegate_data = self.read(cr, uid, ids, context=context)[0]
task = task_obj.browse(cr, uid, context['active_id'], context=context)
diff --git a/addons/project/wizard/project_task_delegate_view.xml b/addons/project/wizard/project_task_delegate_view.xml
index 65478e74f0b..762810eba64 100644
--- a/addons/project/wizard/project_task_delegate_view.xml
+++ b/addons/project/wizard/project_task_delegate_view.xml
@@ -25,7 +25,7 @@
-
+
@@ -44,4 +44,4 @@
-
\ No newline at end of file
+
diff --git a/addons/project_caldav/__openerp__.py b/addons/project_caldav/__openerp__.py
index b3e0be57cad..c8f379b18e5 100644
--- a/addons/project_caldav/__openerp__.py
+++ b/addons/project_caldav/__openerp__.py
@@ -20,15 +20,15 @@
##############################################################################
{
- "name" : "Caldav task management",
- "version" : "1.0",
- "author" : "Tiny",
- "category" : "Generic Modules/Others",
+ "name": "Caldav task management",
+ "version": "1.0",
+ "author": "Tiny",
+ "category": "Generic Modules/Others",
"description": """ Synchronize between Project task and Caldav Vtodo.""",
- "depends" : ["project", "caldav", "base_calendar"],
- "init_xml" : ["project_caldav_data.xml"],
- "demo_xml" : [],
- "update_xml" : ["project_caldav_view.xml"],
+ "depends": ["project", "caldav", "base_calendar"],
+ "init_xml": ["project_caldav_data.xml"],
+ "demo_xml": [],
+ "update_xml": ["project_caldav_view.xml"],
"active": False,
"website": "http://www.openerp.com",
"installable": True,
diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py
index 62e18784887..b6a87516194 100644
--- a/addons/project_caldav/project_caldav.py
+++ b/addons/project_caldav/project_caldav.py
@@ -26,8 +26,8 @@ class project_task(osv.osv):
_name = "project.task"
_inherit = ["calendar.todo", "project.task"]
_columns = {
- 'write_date' : fields.datetime('Write Date'),
- 'create_date' : fields.datetime('Create Date'),
+ 'write_date': fields.datetime('Write Date'),
+ 'create_date': fields.datetime('Create Date'),
'attendee_ids': fields.many2many('calendar.attendee', \
'task_attendee_rel', 'task_id', 'attendee_id', 'Attendees'),
}
@@ -37,7 +37,9 @@ class project_task(osv.osv):
vals = todo_obj.import_cal(cr, uid, data, context=context)
return self.check_import(cr, uid, vals, context=context)
- def check_import(self, cr, uid, vals, context={}):
+ def check_import(self, cr, uid, vals, context=None):
+ if context is None:
+ context = {}
ids = []
for val in vals:
obj_tm = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.project_time_mode_id
@@ -65,7 +67,9 @@ class project_task(osv.osv):
ids.append(task_id)
return ids
- def export_cal(self, cr, uid, ids, context={}):
+ def export_cal(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
task_datas = self.read(cr, uid, ids, [], context ={'read': True})
tasks = []
for task in task_datas:
@@ -75,8 +79,7 @@ class project_task(osv.osv):
todo_obj = self.pool.get('basic.calendar.todo')
ical = todo_obj.export_cal(cr, uid, tasks, context={'model': self._name})
calendar_val = ical.serialize()
- calendar_val = calendar_val.replace('"', '').strip()
- return calendar_val
+ return calendar_val.replace('"', '').strip()
project_task()
diff --git a/addons/project_caldav/project_caldav_data.xml b/addons/project_caldav/project_caldav_data.xml
index af0088cf72f..a6b7ef870f4 100644
--- a/addons/project_caldav/project_caldav_data.xml
+++ b/addons/project_caldav/project_caldav_data.xml
@@ -74,11 +74,11 @@
-
-
-
- field
-
+
+
+
+ field
+
diff --git a/addons/project_caldav/project_caldav_view.xml b/addons/project_caldav/project_caldav_view.xml
index 89ebe9e85da..3055fee85bc 100644
--- a/addons/project_caldav/project_caldav_view.xml
+++ b/addons/project_caldav/project_caldav_view.xml
@@ -14,10 +14,9 @@
name="%(base_calendar.action_view_calendar_invite_attendee_wizard)d"
icon="terp-partner" type="action"
context="{'model' : 'project.task'}" colspan="2"/>
-
-
+
@@ -29,15 +28,12 @@
-
+
-
-
+
+
@@ -68,8 +64,7 @@
-
+
-
+
diff --git a/addons/project_gtd/project_gtd.py b/addons/project_gtd/project_gtd.py
index d680e533505..c2222fdb5d6 100644
--- a/addons/project_gtd/project_gtd.py
+++ b/addons/project_gtd/project_gtd.py
@@ -46,7 +46,7 @@ class project_gtd_context(osv.osv):
'project_default_id': fields.many2one('project.project', 'Default Project', required=True),
}
_defaults = {
- 'sequence': lambda *args: 1
+ 'sequence': 1
}
_order = "sequence, name"
@@ -125,15 +125,18 @@ class project_task(osv.osv):
}
def copy_data(self, cr, uid, id, default=None, context=None):
+ if context is None:
+ context = {}
if not default:
default = {}
- default['timebox_id']=False
- default['context_id']=False
+ default['timebox_id'] = False
+ default['context_id'] = False
return super(project_task,self).copy_data(cr, uid, id, default, context)
- def _get_context(self,cr, uid, ctx):
- ids = self.pool.get('project.gtd.context').search(cr, uid, [], context=ctx)
+ def _get_context(self,cr, uid, context=None):
+ ids = self.pool.get('project.gtd.context').search(cr, uid, [], context=context)
return ids and ids[0] or False
+
_defaults = {
'context_id': _get_context
}
@@ -192,7 +195,7 @@ class project_task(osv.osv):
context_id_info['context_id']['selection'] = attrs_sel
res['fields'].update(context_id_info)
return res
+
project_task()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/project_gtd/project_gtd_demo.xml b/addons/project_gtd/project_gtd_demo.xml
index 06deb221f36..a696e901686 100644
--- a/addons/project_gtd/project_gtd_demo.xml
+++ b/addons/project_gtd/project_gtd_demo.xml
@@ -67,7 +67,7 @@
24.0
24.0
-
+
Validation + latest modifications.
@@ -100,7 +100,7 @@
24.0
24.0
-
+
Validation + latest modifications.
diff --git a/addons/project_gtd/project_gtd_view.xml b/addons/project_gtd/project_gtd_view.xml
index f5639ea5629..919412cd27d 100644
--- a/addons/project_gtd/project_gtd_view.xml
+++ b/addons/project_gtd/project_gtd_view.xml
@@ -13,6 +13,7 @@
+
project.gtd.context.form
project.gtd.context
@@ -25,6 +26,7 @@
+
Contexts
project.gtd.context
@@ -70,6 +72,7 @@
+
project.task.tree.timebox
project.task
diff --git a/addons/project_gtd/wizard/project_gtd_empty.py b/addons/project_gtd/wizard/project_gtd_empty.py
index 4eb4de12c12..01629af87b4 100644
--- a/addons/project_gtd/wizard/project_gtd_empty.py
+++ b/addons/project_gtd/wizard/project_gtd_empty.py
@@ -63,4 +63,4 @@ class project_timebox_empty(osv.osv_memory):
project_timebox_empty()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_gtd/wizard/project_gtd_fill.py b/addons/project_gtd/wizard/project_gtd_fill.py
index 8b39dac16ae..34e4a8c2457 100644
--- a/addons/project_gtd/wizard/project_gtd_fill.py
+++ b/addons/project_gtd/wizard/project_gtd_fill.py
@@ -32,10 +32,14 @@ class project_timebox_fill(osv.osv_memory):
}
def _get_from_tb(self, cr, uid, context=None):
+ if context is None:
+ context = {}
ids = self.pool.get('project.gtd.timebox').search(cr, uid, [], context=context)
return ids and ids[0] or False
def _get_to_tb(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
return context['active_id']
return False
@@ -58,4 +62,4 @@ class project_timebox_fill(osv.osv_memory):
project_timebox_fill()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_issue/__openerp__.py b/addons/project_issue/__openerp__.py
index 97f9e96afa0..ff90c5c131b 100644
--- a/addons/project_issue/__openerp__.py
+++ b/addons/project_issue/__openerp__.py
@@ -48,9 +48,9 @@
"board_project_issue_view.xml",
],
'demo_xml': ['project_issue_demo.xml'],
- 'test' : [
- 'test/convert_issue_to_task.yml',
- 'test/test_project_issue_states.yml'
+ 'test': [
+ 'test/convert_issue_to_task.yml',
+ 'test/test_project_issue_states.yml'
],
'installable': True,
'active': False,
diff --git a/addons/project_issue/board_project_issue_view.xml b/addons/project_issue/board_project_issue_view.xml
index 8b038d1036a..8fe05eddebe 100644
--- a/addons/project_issue/board_project_issue_view.xml
+++ b/addons/project_issue/board_project_issue_view.xml
@@ -85,9 +85,7 @@
menu
-
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index aebb7356405..f13f816b4ca 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -25,14 +25,14 @@ import re
import time
import mx.DateTime
from datetime import datetime, timedelta
+import binascii
+import collections
import tools
from crm import crm
from osv import fields,osv,orm
from osv.orm import except_orm
from tools.translate import _
-import collections
-import binascii
import tools
class project_issue(osv.osv, crm.crm_case):
@@ -54,7 +54,9 @@ class project_issue(osv.osv, crm.crm_case):
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
return res
- def _compute_day(self, cr, uid, ids, fields, args, context={}):
+ def _compute_day(self, cr, uid, ids, fields, args, context=None):
+ if context is None:
+ context = {}
"""
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@@ -66,7 +68,7 @@ class project_issue(osv.osv, crm.crm_case):
res_obj = self.pool.get('resource.resource')
res = {}
- for issue in self.browse(cr, uid, ids, context):
+ for issue in self.browse(cr, uid, ids, context=context):
for field in fields:
res[issue.id] = {}
duration = 0
@@ -102,13 +104,7 @@ class project_issue(osv.osv, crm.crm_case):
duration = float(ans.days)
if issue.project_id and issue.project_id.resource_calendar_id:
duration = float(ans.days) * 24
- new_dates = cal_obj.interval_min_get(cr,
- uid,
- issue.project_id.resource_calendar_id.id,
- mx.DateTime.strptime(issue.create_date, '%Y-%m-%d %H:%M:%S'),
- duration,
- resource=resource_id
- )
+ new_dates = cal_obj.interval_min_get(cr, uid, issue.project_id.resource_calendar_id.id, mx.DateTime.strptime(issue.create_date, '%Y-%m-%d %H:%M:%S'), duration, resource=resource_id)
no_days = []
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
@@ -127,8 +123,8 @@ class project_issue(osv.osv, crm.crm_case):
'id': fields.integer('ID'),
'name': fields.char('Name', size=128, required=True),
'active': fields.boolean('Active', required=False),
- 'create_date': fields.datetime('Creation Date' , readonly=True),
- 'write_date': fields.datetime('Update Date' , readonly=True),
+ 'create_date': fields.datetime('Creation Date', readonly=True),
+ 'write_date': fields.datetime('Update Date', readonly=True),
'date_deadline': fields.date('Deadline'),
'date_closed': fields.datetime('Closed', readonly=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
@@ -140,28 +136,22 @@ class project_issue(osv.osv, crm.crm_case):
domain="[('partner_id','=',partner_id)]"),
'company_id': fields.many2one('res.company', 'Company'),
'description': fields.text('Description'),
- 'state': fields.selection([
- ('draft', 'Draft'),
- ('open', 'Todo'),
- ('cancel', 'Cancelled'),
- ('done', 'Closed'),
- ('pending', 'Pending'),
- ], 'State', size=16, readonly=True,
+ 'state': fields.selection([('draft', 'Draft'), ('open', 'Todo'), ('cancel', 'Cancelled'), ('done', 'Closed'),('pending', 'Pending'), ], 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'email_from': fields.char('Email', size=128, help="These people will receive email."),
- 'email_cc': fields.text('Watchers Emails', size=252 , help="These people\
+ 'email_cc': fields.text('Watchers Emails', size=252, help="These people\
will receive a copy of the future" \
" communication between partner and users by email"),
'date_open': fields.datetime('Opened', readonly=True),
# Project Issue fields
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
- 'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \
+ 'canal_id': fields.many2one('res.partner.canal', 'Channel', help="The channels represent the different communication modes available with the customer." \
" With each commercial opportunity, you can indicate the canall which is this opportunity source."),
- 'categ_id': fields.many2one('crm.case.categ','Category', domain="[('object_id.model', '=', 'crm.project.bug')]"),
+ 'categ_id': fields.many2one('crm.case.categ', 'Category', domain="[('object_id.model', '=', 'crm.project.bug')]"),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Severity'),
'type_id': fields.many2one('crm.case.resource.type', 'Version', domain="[('object_id.model', '=', 'project.issue')]"),
'partner_name': fields.char("Employee's Name", size=64),
@@ -176,7 +166,7 @@ class project_issue(osv.osv, crm.crm_case):
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="float", store=True),
- 'assigned_to' : fields.many2one('res.users', 'Assigned to'),
+ 'assigned_to': fields.many2one('res.users', 'Assigned to'),
'working_hours_open': fields.function(_compute_day, string='Working Hours to Open the Issue', \
method=True, multi='working_days_open', type="float", store=True),
'working_hours_close': fields.function(_compute_day, string='Working Hours to Close the Issue', \
@@ -194,15 +184,15 @@ class project_issue(osv.osv, crm.crm_case):
return False
_defaults = {
- 'active': lambda *a: 1,
+ 'active': 1,
'user_id': crm.crm_case._get_default_user,
'partner_id': crm.crm_case._get_default_partner,
'partner_address_id': crm.crm_case._get_default_partner_address,
'email_from': crm.crm_case. _get_default_email,
- 'state': lambda *a: 'draft',
+ 'state': 'draft',
'section_id': crm.crm_case. _get_section,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
- 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
+ 'priority': crm.AVAILABLE_PRIORITIES[2][0],
'project_id':_get_project,
}
@@ -229,9 +219,9 @@ class project_issue(osv.osv, crm.crm_case):
'partner_id': bug.partner_id.id,
'description':bug.description,
'date': bug.date,
- 'project_id':bug.project_id.id,
- 'priority':bug.priority,
- 'user_id':bug.assigned_to.id,
+ 'project_id': bug.project_id.id,
+ 'priority': bug.priority,
+ 'user_id': bug.assigned_to.id,
'planned_hours': 0.0,
})
@@ -269,7 +259,9 @@ class project_issue(osv.osv, crm.crm_case):
def convert_to_bug(self, cr, uid, ids, context=None):
return self._convert(cr, uid, ids, 'bug_categ', context=context)
- def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):
+ def onchange_stage_id(self, cr, uid, ids, stage_id, context=None):
+ if context is None:
+ context = {}
if not stage_id:
return {'value':{}}
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context)
@@ -300,7 +292,7 @@ class project_issue(osv.osv, crm.crm_case):
def message_new(self, cr, uid, msg, context):
"""
Automatically calls when new email message arrives
-
+
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks
@@ -312,7 +304,7 @@ class project_issue(osv.osv, crm.crm_case):
body = msg.get('body')
msg_from = msg.get('from')
priority = msg.get('priority')
-
+
vals = {
'name': subject,
'email_from': msg_from,
@@ -322,18 +314,18 @@ class project_issue(osv.osv, crm.crm_case):
}
if msg.get('priority', False):
vals['priority'] = priority
-
+
res = mailgate_pool.get_partner(cr, uid, msg.get('from'))
if res:
vals.update(res)
res = self.create(cr, uid, vals, context)
self.convert_to_bug(cr, uid, [res], context=context)
-
+
attachents = msg.get('attachments', [])
for attactment in attachents or []:
data_attach = {
'name': attactment,
- 'datas':binascii.b2a_base64(str(attachents.get(attactment))),
+ 'datas': binascii.b2a_base64(str(attachents.get(attactment))),
'datas_fname': attactment,
'description': 'Mail attachment',
'res_model': self._name,
@@ -343,17 +335,19 @@ class project_issue(osv.osv, crm.crm_case):
return res
- def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context={}):
- """
+ def message_update(self, cr, uid, ids, vals={}, msg="", default_act='pending', context=None):
+ if context is None:
+ context = {}
+ """
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
- @param ids: List of update mail’s IDs
+ @param ids: List of update mail’s IDs
"""
-
+
if isinstance(ids, (str, int, long)):
ids = [ids]
-
+
vals.update({
'description': msg['body']
})
@@ -361,9 +355,9 @@ class project_issue(osv.osv, crm.crm_case):
vals['priority'] = msg.get('priority')
maps = {
- 'cost':'planned_cost',
+ 'cost': 'planned_cost',
'revenue': 'planned_revenue',
- 'probability':'probability'
+ 'probability': 'probability'
}
vls = { }
for line in msg['body'].split('\n'):
@@ -372,7 +366,7 @@ class project_issue(osv.osv, crm.crm_case):
if res and maps.get(res.group(1).lower(), False):
key = maps.get(res.group(1).lower())
vls[key] = res.group(2).lower()
-
+
vals.update(vls)
res = self.write(cr, uid, ids, vals)
return res
@@ -399,4 +393,4 @@ class project(osv.osv):
}
project()
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml
index a87039274f3..fb914dfaca2 100644
--- a/addons/project_issue/project_issue_data.xml
+++ b/addons/project_issue/project_issue_data.xml
@@ -1,6 +1,7 @@
+
@@ -11,6 +12,7 @@
+
Feature Requests
@@ -25,7 +27,8 @@
Version 4.2
-
+
+
Version 4.4
@@ -67,5 +70,6 @@
+
diff --git a/addons/project_issue/project_issue_demo.xml b/addons/project_issue/project_issue_demo.xml
index aee12ccf01e..ad6af0e02b0 100644
--- a/addons/project_issue/project_issue_demo.xml
+++ b/addons/project_issue/project_issue_demo.xml
@@ -1,6 +1,7 @@
+
diff --git a/addons/project_issue/project_issue_menu.xml b/addons/project_issue/project_issue_menu.xml
index fefdd496559..05080670e10 100644
--- a/addons/project_issue/project_issue_menu.xml
+++ b/addons/project_issue/project_issue_menu.xml
@@ -2,7 +2,6 @@
-
######################## ISSUE TRACKING (menu) ###########################