From 2831d94c207be72b6d014353c048e145ad8ed595 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 18 Nov 2015 13:41:17 +0100 Subject: [PATCH 1/2] [FIX] survey: no attachment in shared survey When sharing a survey, a mail.mail is created but the attachment were lost. This is due to a missing command (6, _, ids) when creating records in attachment_ids field (many2many). Fixes #9364, opw 656742 --- addons/survey/wizard/survey_email_compose_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/survey/wizard/survey_email_compose_message.py b/addons/survey/wizard/survey_email_compose_message.py index 516c18af799..a9a244f1138 100644 --- a/addons/survey/wizard/survey_email_compose_message.py +++ b/addons/survey/wizard/survey_email_compose_message.py @@ -154,7 +154,7 @@ class survey_mail_compose_message(osv.TransientModel): 'parent_id': None, 'partner_ids': partner_id and [(4, partner_id)] or None, 'notified_partner_ids': partner_id and [(4, partner_id)] or None, - 'attachment_ids': wizard.attachment_ids or None, + 'attachment_ids': wizard.attachment_ids and [(6, 0, wizard.attachment_ids.ids)] or None, 'email_from': wizard.email_from or None, 'email_to': email, } From f57e580f2dd976d217ca37b67d1583d6f2c152f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 18 Nov 2015 14:17:24 +0100 Subject: [PATCH 2/2] [FIX] project_issue: correctly update alias When choosing use tasks / use issues, correctly update the project alias. Indeed only the use issues checkbox had an onchange. This revision adds the onchange on use tasks so that the method correctly computes the new alias destination model. Also updated the _get_alias_models method to be more modular instead of hardcoding values. Call super. --- addons/project_issue/project_issue.py | 4 +++- addons/project_issue/project_issue_view.xml | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 15039912ce7..8914f1ebda2 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -464,7 +464,9 @@ class project(osv.Model): _inherit = "project.project" def _get_alias_models(self, cr, uid, context=None): - return [('project.task', "Tasks"), ("project.issue", "Issues")] + res = super(project, self)._get_alias_models(cr, uid, context=context) + res.append(("project.issue", "Issues")) + return res def _issue_count(self, cr, uid, ids, field_name, arg, context=None): Issue = self.pool['project.issue'] diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 79a4072f2dd..596aaa01135 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -294,6 +294,9 @@ project.project + + on_change_use_tasks_or_issues(use_tasks, use_issues) +