diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 39fcfcd24c4..3e10fc140e1 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -123,7 +123,7 @@ class email_template(osv.osv): _columns = { 'name' : fields.char('Name', size=100, required=True), - 'object_name':fields.many2one('ir.model', 'Model'), + 'object_name':fields.many2one('ir.model', 'Resource'), 'model_int_name':fields.char('Model Internal Name', size=200,), 'from_account':fields.many2one( 'email_template.account', @@ -132,7 +132,7 @@ class email_template(osv.osv): 'def_to':fields.char( 'Recipient (To)', size=250, - help="The default recipient of email." + help="The Recipient of email. " "Placeholders can be used here."), 'def_cc':fields.char( 'CC', @@ -151,12 +151,12 @@ class email_template(osv.osv): " Placeholders can be used here."), 'message_id':fields.char('Message-ID', size=250, - help="The Message-ID header value, if you need to" - "specify it, for example to automatically recognize the replies later." - " Placeholders can be used here."), - 'track_campaign_item':fields.boolean('Track campaign items', - help="Enable this if you want the outgoing e-mails to include a tracking" - " marker that makes it possible to identify the replies an link them back to the campaign item"), + help="Specify the Message-ID SMTP header to use in outgoing emails. Please note that this overrides the Resource tracking option! Placeholders can be used here."), + 'track_campaign_item':fields.boolean('Resource Tracking', + help="Enable this is you wish to include a special \ +tracking marker in outgoing emails so you can identify replies and link \ +them back to the corresponding resource record. \ +This is useful for CRM leads for example"), 'lang':fields.char( 'Language', size=250, @@ -164,9 +164,9 @@ class email_template(osv.osv): " Placeholders can be used here. " "eg. ${object.partner_id.lang}"), 'def_subject':fields.char( - 'Default Subject', + 'Subject', size=200, - help="The default subject of email." + help="The subject of email." " Placeholders can be used here.", translate=True), 'def_body_text':fields.text( @@ -201,10 +201,12 @@ class email_template(osv.osv): 'ref_ir_act_window':fields.many2one( 'ir.actions.act_window', 'Window Action', + help="Action that will open this email template on Resource records", readonly=True), 'ref_ir_value':fields.many2one( 'ir.values', 'Wizard Button', + help="Button in the side bar of the form view of this Resource that will invoke the Window Action", readonly=True), 'allowed_groups':fields.many2many( 'res.groups', @@ -636,9 +638,13 @@ class email_template(osv.osv): 'mail_type':'multipart/alternative', } + if template['message_id']: + # use provided message_id with placeholders + mailbox_values.update({'message_id': get_value(cursor, user, record_id, template['message_id'], template, context)}) + if template['track_campaign_item']: # get appropriate message-id - mailbox_values.update(message_id=tools.misc.generate_tracking_message_id(record_id)) + mailbox_values.update({'message_id': tools.misc.generate_tracking_message_id(record_id)}) if not mailbox_values['account_id']: raise Exception("Unable to send the mail. No account linked to the template.") diff --git a/addons/email_template/email_template_account.py b/addons/email_template/email_template_account.py index b54d0fac4c5..fdbcaa703bc 100644 --- a/addons/email_template/email_template_account.py +++ b/addons/email_template/email_template_account.py @@ -80,7 +80,12 @@ class email_template_account(osv.osv): 'name': fields.char('Description', size=64, required=True, readonly=True, select=True, + help="The description is used as the Sender name along with the provided From Email, \ +unless it is already specified in the From Email, e.g: John Doe ", states={'draft':[('readonly', False)]}), + 'auto_delete': fields.boolean('Auto Delete', size=64, readonly=True, + help="Permanently delete emails after sending", + states={'draft':[('readonly', False)]}), 'user':fields.many2one('res.users', 'Related User', required=True, readonly=True, states={'draft':[('readonly', False)]}), @@ -133,7 +138,7 @@ class email_template_account(osv.osv): ('suspended', 'Suspended'), ('approved', 'Approved') ], - 'Status', required=True, readonly=True), + 'State', required=True, readonly=True), } _defaults = { @@ -189,25 +194,7 @@ class email_template_account(osv.osv): 'Error: You are not allowed to have more than 1 account.', []) ] - - def on_change_emailid(self, cursor, user, ids, name=None, email_id=None, context=None): - """ - Called when the email ID field changes. - - UI enhancement - Writes the same email value to the smtpusername - and incoming username - """ - #TODO: Check and remove the write. Is it needed? - self.write(cursor, user, ids, {'state':'draft'}, context=context) - return { - 'value': { - 'state': 'draft', - 'smtpuname':email_id, - 'isuser':email_id - } - } - + def get_outgoing_server(self, cursor, user, ids, context=None): """ Returns the Out Going Connection (SMTP) object diff --git a/addons/email_template/email_template_account_view.xml b/addons/email_template/email_template_account_view.xml index 544ad016136..9ccf3e63800 100644 --- a/addons/email_template/email_template_account_view.xml +++ b/addons/email_template/email_template_account_view.xml @@ -18,16 +18,17 @@ - - - - - + + + + + +