diff options
| author | uco (OpenERP) <uco@tinyerp.com> | 2010-11-22 16:07:53 +0530 |
|---|---|---|
| committer | uco (OpenERP) <uco@tinyerp.com> | 2010-11-22 16:07:53 +0530 |
| commit | 8035df3e1152a8f9d9703037d9d1bee718d94331 (patch) | |
| tree | 37b500a41ff73f797ea1ba40ea53d2baee75d329 /addons/project_long_term/project_long_term.py | |
| parent | 427cd9af231844c42741a1d8a2a6ac3d0b23c540 (diff) | |
[IMP]: Added context=None in function argument for rest modules.
bzr revid: uco@tinyerp.com-20101122103753-idv9fdaqc28rvugu
Diffstat (limited to 'addons/project_long_term/project_long_term.py')
| -rw-r--r-- | addons/project_long_term/project_long_term.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index faea0916906..6d26f0dd009 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -70,18 +70,24 @@ class project_phase(osv.osv): return True def _check_dates(self, cr, uid, ids, context=None): + if not context: + context = {} for phase in self.read(cr, uid, ids, ['date_start', 'date_end'], context=context): if phase['date_start'] and phase['date_end'] and phase['date_start'] > phase['date_end']: return False return True def _check_constraint_start(self, cr, uid, ids, context=None): + if not context: + context = {} phase = self.read(cr, uid, ids[0], ['date_start', 'constraint_date_start'], context=context) if phase['date_start'] and phase['constraint_date_start'] and phase['date_start'] < phase['constraint_date_start']: return False return True def _check_constraint_end(self, cr, uid, ids, context=None): + if not context: + context = {} phase = self.read(cr, uid, ids[0], ['date_end', 'constraint_date_end'], context=context) if phase['date_end'] and phase['constraint_date_end'] and phase['date_end'] > phase['constraint_date_end']: return False @@ -96,6 +102,8 @@ class project_phase(osv.osv): res = {} if not ids: return res + if not context: + context = {} for phase in self.browse(cr, uid, ids, context=context): tot = 0.0 for task in phase.task_ids: @@ -137,6 +145,8 @@ class project_phase(osv.osv): def onchange_project(self, cr, uid, ids, project, context=None): result = {} + if not context: + context = {} result['date_start'] = False project_obj = self.pool.get('project.project') if project: @@ -146,6 +156,8 @@ class project_phase(osv.osv): def onchange_days(self, cr, uid, ids, project, context=None): result = {} + if not context: + context = {} for id in ids: project_id = self.browse(cr, uid, id, context=context) newdate = datetime.strptime(project_id.date_start, '%Y-%m-%d') + relativedelta(days=project_id.duration or 0.0) @@ -398,6 +410,8 @@ class project_resource_allocation(osv.osv): def get_name(self, cr, uid, ids, field_name, arg, context=None): res = {} + if not context: + context = {} for allocation in self.browse(cr, uid, ids, context=context): name = allocation.phase_id.name name += ' (%s%%)' %(allocation.useability) @@ -507,7 +521,7 @@ class resource_resource(osv.osv): context = {} if context.get('project_id',False): project_pool = self.pool.get('project.project') - project_rec = project_pool.browse(cr, uid, context['project_id']) + project_rec = project_pool.browse(cr, uid, context['project_id'], context=context) user_ids = [user_id.id for user_id in project_rec.members] args.append(('user_id','in',user_ids)) return super(resource_resource, self).search(cr, uid, args, offset, limit, order, context, count) |
