diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py index 9a4e948cbe1..01c35880fbb 100644 --- a/addons/caldav/calendar.py +++ b/addons/caldav/calendar.py @@ -186,6 +186,8 @@ def map_data(cr, uid, obj, context=None): if field_type == 'selection': if not map_val: continue + if type(map_val) == list and len(map_val): #TOFIX: why need to check this + map_val = map_val[0] mapping = obj.__attribute__[map_dict].get('mapping', False) if mapping: map_val = mapping.get(map_val.lower(), False) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 078cbdc475c..85225505237 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -186,10 +186,9 @@ This is useful for CRM leads for example"), help="the signature from the User details" " will be appended to the mail"), 'file_name':fields.char( - 'File Name Pattern', + 'Report Filename', size=200, - help="File name pattern can be specified with placeholders." - "eg. 2009_SO003.pdf", + help="Name of the generated report file. Placeholders can be used in the filename. eg: 2009_SO003.pdf", translate=True), 'report_template':fields.many2one( 'ir.actions.report.xml', @@ -646,8 +645,8 @@ This is useful for CRM leads for example"), # 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 + elif template['track_campaign_item']: + # get appropriate message-id mailbox_values.update({'message_id': tools.misc.generate_tracking_message_id(record_id)}) if not mailbox_values['account_id']: @@ -734,7 +733,7 @@ class email_template_preview(osv.osv_memory): context = {} #Fills up the selection box which allows records from the selected object to be displayed self.context = context - if 'template_id' in context.keys(): + if 'template_id' in context: ref_obj_id = self.pool.get('email.template').read(cr, uid, context['template_id'], ['object_name'], context) ref_obj_name = self.pool.get('ir.model').read(cr, uid, ref_obj_id['object_name'][0], ['model'], context)['model'] model_obj = self.pool.get(ref_obj_name) @@ -746,6 +745,16 @@ class email_template_preview(osv.osv_memory): ref_obj_ids.insert(0, default_id) return model_obj.name_get(cr, uid, ref_obj_ids, context) + def default_get(self, cr, uid, fields, context=None): + if context is None: + context = {} + result = super(email_template_preview, self).default_get(cr, uid, fields, context=context) + if (not fields or 'rel_model_ref' in fields) and 'template_id' in context \ + and not result.get('rel_model_ref'): + selectables = self._get_model_recs(cr, uid, context=context) + result['rel_model_ref'] = selectables and selectables[0][0] or False + return result + def _default_model(self, cursor, user, context=None): """ Returns the default value for model field @@ -786,7 +795,7 @@ class email_template_preview(osv.osv_memory): } _defaults = { 'ref_template': lambda self, cr, uid, ctx:ctx['template_id'], - 'rel_model': _default_model + 'rel_model': _default_model, } def on_change_ref(self, cr, uid, ids, rel_model_ref, context=None): if context is None: diff --git a/addons/email_template/email_template_account.py b/addons/email_template/email_template_account.py index fdbcaa703bc..24b7958276d 100644 --- a/addons/email_template/email_template_account.py +++ b/addons/email_template/email_template_account.py @@ -92,15 +92,15 @@ unless it is already specified in the From Email, e.g: John Doe ", 'email_id': fields.char('From Email', size=120, required=True, readonly=True, states={'draft':[('readonly', False)]} , - help="eg: yourname@yourdomain.com "), + help="eg: 'john@doe.com' or 'John Doe '"), 'smtpserver': fields.char('Server', size=120, required=True, readonly=True, states={'draft':[('readonly', False)]}, - help="Enter name of outgoing server, eg:smtp.gmail.com "), - 'smtpport': fields.integer('SMTP Port ', + help="Enter name of outgoing server, eg: smtp.yourdomain.com"), + 'smtpport': fields.integer('SMTP Port', size=64, required=True, readonly=True, states={'draft':[('readonly', False)]}, - help="Enter port number,eg:SMTP-587 "), + help="Enter port number, eg: 25 or 587"), 'smtpuname': fields.char('User Name', size=120, required=False, readonly=True, states={'draft':[('readonly', False)]}, diff --git a/addons/email_template/email_template_account_view.xml b/addons/email_template/email_template_account_view.xml index 201f32db726..0c30d7d478f 100644 --- a/addons/email_template/email_template_account_view.xml +++ b/addons/email_template/email_template_account_view.xml @@ -20,12 +20,12 @@ +