From 402ac6b91c6b5554660d4e062855874e96bbf0ae Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Tue, 30 Aug 2016 16:36:19 +0200 Subject: [PATCH] [FIX] project_issue: issue: correctly set stage_id during onchange project_id If you create an issue when `default_project_id` is set, the stage_id is initialized at the lowest sequence of the stages of the project, which is normal. However, when you change the project of the task, the stage_id was not correctly reset. If you save at this time, you add the selected stage in the project. Also, the stage_id was not correctly cleared if you remove the project. --- addons/project_issue/project_issue.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 1ef48793516..b924c2d4556 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -123,11 +123,18 @@ class project_issue(osv.Model): return res def on_change_project(self, cr, uid, ids, project_id, context=None): + values = {} 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, 'email_from': project.partner_id.email}} - return {} + values['partner_id'] = project.partner_id.id + values['email_from'] = project.partner_id.email + values['stage_id'] = self.stage_find(cr, uid, [], project_id, [('fold', '=', False)], context=context) + else: + values['partner_id'] = False + values['email_from'] = False + values['stage_id'] = False + return {'value': values} _columns = { 'id': fields.integer('ID', readonly=True),