[MERGE] fix the default stage in task and project_issue. branch from cbi

bzr revid: qdp-launchpad@openerp.com-20121228112202-i81ozel71m8zod72
This commit is contained in:
Quentin (OpenERP)
2012-12-28 12:22:02 +01:00
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -1089,6 +1089,10 @@ class task(base_stage, osv.osv):
return True
def create(self, cr, uid, vals, context=None):
if not context.get('default_project_id', False) and vals.get('project_id', False):
ctx = context.copy()
ctx['default_project_id'] = vals['project_id']
vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
task_id = super(task, self).create(cr, uid, vals, context=context)
self._store_history(cr, uid, [task_id], context=context)
return task_id
+7
View File
@@ -64,6 +64,13 @@ class project_issue(base_stage, osv.osv):
},
}
def create(self, cr, uid, vals, context=None):
if not context.get('default_project_id', False) and vals.get('project_id', False):
ctx = context.copy()
ctx['default_project_id'] = vals['project_id']
vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx)
return super(project_issue, self).create(cr, uid, vals, context=context)
def _get_default_project_id(self, cr, uid, context=None):
""" Gives default project by checking if present in the context """
return self._resolve_project_id_from_context(cr, uid, context=context)