diff --git a/addons/email_template/wizard/email_template_send_wizard.py b/addons/email_template/wizard/email_template_send_wizard.py index 138060a962d..fe3e581e21c 100644 --- a/addons/email_template/wizard/email_template_send_wizard.py +++ b/addons/email_template/wizard/email_template_send_wizard.py @@ -99,6 +99,15 @@ class email_template_send_wizard(osv.osv_memory): else: # Simple Mail: Gets computed template values return self.get_value(cr, uid, template, getattr(template, field), context) + def default_get(self, cr, uid, fields, context=None): + if context is None: + context = {} + result = super(email_template_send_wizard, self).default_get(cr, uid, fields, context=context) + if 'template_id' in context and context.get('template_id'): + temp_data = self.pool.get('email.template').read(cr, uid, int(context.get('template_id')), ['attachment_ids']) + result['attachment_ids'] = temp_data['attachment_ids'] + return result + _columns = { 'state':fields.selection([ ('single','Simple Mail Wizard Step 1'), @@ -151,8 +160,6 @@ class email_template_send_wizard(osv.osv_memory): 'reply_to': lambda self,cr,uid,ctx: self._get_template_value(cr, uid, 'reply_to', ctx), 'reply_to': lambda self,cr,uid,ctx: self._get_template_value(cr, uid, 'reply_to', ctx), 'requested':lambda self,cr,uid,ctx: len(ctx.get('src_rec_ids','')), - 'full_success': False, - 'attachment_ids': [], } def fields_get(self, cr, uid, fields=None, context=None, write_access=True): @@ -253,7 +260,7 @@ class email_template_send_wizard(osv.osv_memory): 'res_model': 'email.message', 'res_id': mail_id }, context) - attachment_ids.append( attachment_id ) + attachment_ids.append(attachment_id) # Add document attachments for attachment_id in screen_vals.get('attachment_ids',[]): @@ -263,6 +270,7 @@ class email_template_send_wizard(osv.osv_memory): }, context) attachment_ids.append(new_id) if attachment_ids: + #Need to Fix email_message_obj.write(cr, uid, mail_id, { 'attachments_ids': [[6, 0, attachment_ids]], }, context) diff --git a/addons/emails/email_message.py b/addons/emails/email_message.py index 2c696dc3791..9b2d08ed247 100644 --- a/addons/emails/email_message.py +++ b/addons/emails/email_message.py @@ -48,7 +48,6 @@ import netsvc #import datetime #import tools #import logging - #email_content_types = [ # 'multipart/mixed', # 'multipart/alternative', @@ -183,12 +182,12 @@ class email_message(osv.osv): ('outbox', 'Outbox'), ('trash', 'Trash'), ('sent', 'Sent Items'), - ], 'Folder', required=True, readonly=True), + ], 'Folder', readonly=True), 'state':fields.selection([ ('na', 'Not Applicable'), ('sending', 'Sending'), ('waiting', 'Waiting'), - ], 'State', required=True, readonly=True), + ], 'State', readonly=True), } _defaults = { @@ -309,6 +308,7 @@ class email_message(osv.osv): logger.notifyChannel("email-template", netsvc.LOG_ERROR, _("Sending of Mail %s failed. Probable Reason:Could not login to server\nError: %s") % (message.id, error)) return ids +# OLD Code. # def send_all_mail(self, cr, uid, ids=None, context=None): # if ids is None: # ids = [] diff --git a/addons/emails/email_view.xml b/addons/emails/email_view.xml index 514cc5a6bd0..333635f566d 100644 --- a/addons/emails/email_view.xml +++ b/addons/emails/email_view.xml @@ -12,8 +12,8 @@
- - + +