diff options
| author | Christophe Matthieu <chm@openerp.com> | 2013-07-10 17:13:56 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@openerp.com> | 2013-07-10 17:13:56 +0200 |
| commit | f3b72182bf0c97fa328ccc4338469b2cd43a5bce (patch) | |
| tree | 82413672da8ebf3777b05223486aafaa0655e1d3 /addons/project_issue/project_issue.py | |
| parent | c8b21aafe7405ec1a76a771dd6a21199ba69cb01 (diff) | |
| parent | f38ef93a05f4d01c1a883565b5520af6ddb21384 (diff) | |
[MERGE] from trunk
bzr revid: chm@openerp.com-20130710151356-b5prp1zqlgd8lz19
Diffstat (limited to 'addons/project_issue/project_issue.py')
| -rw-r--r-- | addons/project_issue/project_issue.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index a69d9356002..91b5633f6d6 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -65,15 +65,22 @@ class project_issue(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): if context is None: context = {} - if not vals.get('stage_id'): - ctx = context.copy() - 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('project_id') and not context.get('default_project_id'): + context['default_project_id'] = vals.get('project_id') + # 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) + def _get_default_partner(self, cr, uid, context=None): + """ Override of base_stage to add project specific behavior """ + project_id = self._get_default_project_id(cr, uid, context) + if project_id: + project = self.pool.get('project.project').browse(cr, uid, project_id, context=context) + if project and project.partner_id: + return project.partner_id.id + return super(project_issue, self)._get_default_partner(cr, uid, 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) @@ -215,6 +222,10 @@ class project_issue(base_stage, osv.osv): return res def on_change_project(self, cr, uid, ids, project_id, context=None): + if project_id: + project = self.pool.get('project.project').browse(cr, uid, project_id, context=context) + if project and project.partner_id: + return {'value': {'partner_id': project.partner_id.id}} return {} def _get_issue_task(self, cr, uid, ids, context=None): @@ -309,6 +320,7 @@ class project_issue(base_stage, osv.osv): 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c), 'priority': crm.AVAILABLE_PRIORITIES[2][0], 'kanban_state': 'normal', + 'user_id': lambda obj, cr, uid, context: uid, } _group_by_full = { |
