[FIX] The default stage for issues and tasks is now correctly a draft stage of the project the issue or task belongs to.
bzr revid: cbi@openerp.com-20121228084527-ive0ope41di6bpjn
This commit is contained in:
parent
22808e5a81
commit
f96f20e4d3
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue