diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 291ddd6a0ef..9adab6d3976 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -315,7 +315,6 @@ class email_template(osv.osv): 'message_id': False, 'state': 'outgoing', 'content_subtype': 'plain', - 'partner_ids': [], } if not template_id: return values @@ -330,13 +329,6 @@ class email_template(osv.osv): template.model, res_id, context=context) \ or False - # if email_to: find or create a partner - if values['email_to']: - partner_id = self.pool.get('mail.thread').message_partner_by_email(cr, uid, values['email_to'], context=context)['partner_id'] - if not partner_id: - partner_id = self.pool.get('res.partner').name_create(cr, uid, values['email_to'], context=context) - values['partner_ids'] = [partner_id] - if values['body_html']: values.update(content_subtype='html') diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 8a172bd62e4..44c30241c13 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -241,6 +241,14 @@ class mail_compose_message(osv.TransientModel): subject = self.render_template(cr, uid, subject, active_model, active_id) body = self.render_template(cr, uid, wizard.body_html, active_model, active_id) + # TODO TDE: find partner_ids + # if email_to: find or create a partner + if values['email_to']: + partner_id = self.pool.get('mail.thread').message_partner_by_email(cr, uid, values['email_to'], context=context)['partner_id'] + if not partner_id: + partner_id = self.pool.get('res.partner').name_create(cr, uid, values['email_to'], context=context) + values['partner_ids'] = [partner_id] + # determine the ids we are commenting if mass_mail_mode: res_ids = context.get('active_ids', []) diff --git a/addons/marketing_campaign/test/marketing_campaign.yml b/addons/marketing_campaign/test/marketing_campaign.yml index 04063a6fbc1..3d540b4ccb7 100644 --- a/addons/marketing_campaign/test/marketing_campaign.yml +++ b/addons/marketing_campaign/test/marketing_campaign.yml @@ -42,7 +42,7 @@ record = self.browse(cr, uid, ids[0]) assert record.state == 'todo' or record.state == 'done' , 'Marketing Workitem shoud be in draft state.' - - I check follow-up detail of first activity. + I process follow-up of first activity. - !python {model: marketing.campaign.workitem}: | ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), @@ -50,12 +50,6 @@ assert ids, 'Follow-up item is not created for first activity.' work_item_id = self.browse(cr ,uid ,ids[0] ,context) assert work_item_id.res_name, 'Resource Name is not defined.' -- - I process follow-up of first activity. -- - !python {model: marketing.campaign.workitem}: | - ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')), - ('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_0'))]) self.process(cr, uid, ids) record = self.browse(cr, uid, ids)[0] assert record.state == "done", "Follow-up item should be closed after process."