email.addresss_id_repalce_by_user_email
bzr revid: rmu@tinyerp.com-20110728061156-swmn5jz78zb3w4vd
This commit is contained in:
parent
f64398fb9d
commit
caa3c07094
|
@ -277,10 +277,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
'object_date': hasattr(obj, 'date') and obj.date or False,
|
||||
'object_description': hasattr(obj, 'description') and obj.description or False,
|
||||
'object_user': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.name) or '/',
|
||||
'object_user_email': hasattr(obj, 'user_id') and (obj.user_id and \
|
||||
obj.user_id.address_id and obj.user_id.address_id.email) or '/',
|
||||
'object_user_phone': hasattr(obj, 'user_id') and (obj.user_id and\
|
||||
obj.user_id.address_id and obj.user_id.address_id.phone) or '/',
|
||||
'object_user_email': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.user_email) or '/',
|
||||
'object_user_phone': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and obj.partner_address_id.phone) or '/',
|
||||
'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/',
|
||||
'partner_email': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and\
|
||||
obj.partner_address_id.email) or '/',
|
||||
|
@ -304,9 +302,9 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
|
||||
body = self.format_mail(obj, body)
|
||||
if not emailfrom:
|
||||
if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.address_id and\
|
||||
obj.user_id.address_id.email:
|
||||
emailfrom = obj.user_id.address_id.email
|
||||
if hasattr(obj, 'user_id') and obj.user_id and\
|
||||
obj.user_id.user_email:
|
||||
emailfrom = obj.user_id.user_email
|
||||
|
||||
name = '[%d] %s' % (obj.id, tools.ustr(obj.name))
|
||||
emailfrom = tools.ustr(emailfrom)
|
||||
|
@ -404,8 +402,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
|
||||
emails = []
|
||||
if hasattr(obj, 'user_id') and action.act_mail_to_user:
|
||||
if obj.user_id and obj.user_id.address_id:
|
||||
emails.append(obj.user_id.address_id.email)
|
||||
if obj.user_id:
|
||||
emails.append(obj.user_id.user_email)
|
||||
|
||||
if action.act_mail_to_watchers:
|
||||
emails += (action.act_email_cc or '').split(',')
|
||||
|
|
|
@ -245,7 +245,7 @@ class calendar_attendee(osv.osv):
|
|||
continue
|
||||
else:
|
||||
result[id][name] = self._get_address(attdata.sent_by_uid.name, \
|
||||
attdata.sent_by_uid.address_id.email)
|
||||
attdata.sent_by_uid.user_email)
|
||||
|
||||
if name == 'cn':
|
||||
if attdata.user_id:
|
||||
|
@ -535,7 +535,7 @@ property or property parameter."),
|
|||
return {'value': {'email': ''}}
|
||||
usr_obj = self.pool.get('res.users')
|
||||
user = usr_obj.browse(cr, uid, user_id, *args)
|
||||
return {'value': {'email': user.address_id.email, 'availability':user.availability}}
|
||||
return {'value': {'email': user.user_email, 'availability':user.availability}}
|
||||
|
||||
def do_tentative(self, cr, uid, ids, context=None, *args):
|
||||
""" Makes event invitation as Tentative
|
||||
|
@ -889,9 +889,9 @@ From:
|
|||
|
||||
""" % (alarm.name, alarm.trigger_date, alarm.description, \
|
||||
alarm.user_id.name, alarm.user_id.signature)
|
||||
mail_to = [alarm.user_id.address_id.email]
|
||||
mail_to = [alarm.user_id.user_email]
|
||||
for att in alarm.attendee_ids:
|
||||
mail_to.append(att.user_id.address_id.email)
|
||||
mail_to.append(att.user_id.user_email)
|
||||
if mail_to:
|
||||
tools.email_send(
|
||||
tools.config.get('email_from', False),
|
||||
|
|
|
@ -98,12 +98,12 @@ send an Email to Invited Person')
|
|||
user = user_obj.browse(cr, uid, user_id)
|
||||
res = {
|
||||
'user_id': user_id,
|
||||
'email': user.address_id.email
|
||||
'email': user.user_email
|
||||
}
|
||||
res.update(ref)
|
||||
vals.append(res)
|
||||
if user.address_id.email:
|
||||
mail_to.append(user.address_id.email)
|
||||
if user.user_email:
|
||||
mail_to.append(user.user_email)
|
||||
|
||||
elif type == 'external' and datas.get('email'):
|
||||
res = {'email': datas['email']}
|
||||
|
|
|
@ -65,7 +65,7 @@ class crm_base(object):
|
|||
context = {}
|
||||
if not context.get('portal'):
|
||||
return False
|
||||
return self.pool.get('res.users').browse(cr, uid, uid, context).address_id.id
|
||||
return self.pool.get('res.partner.address').browse(cr, uid, uid, context)
|
||||
|
||||
def _get_default_partner(self, cr, uid, context=None):
|
||||
"""Gives id of partner for current user
|
||||
|
@ -75,10 +75,8 @@ class crm_base(object):
|
|||
context = {}
|
||||
if not context.get('portal', False):
|
||||
return False
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if not user.address_id:
|
||||
return False
|
||||
return user.address_id.partner_id.id
|
||||
part_id = self.pool.get('res.partner.address').browse(cr, uid, uid, context=context)
|
||||
return part_id.partner_id
|
||||
|
||||
def _get_default_email(self, cr, uid, context=None):
|
||||
"""Gives default email address for current user
|
||||
|
@ -87,9 +85,7 @@ class crm_base(object):
|
|||
if not context.get('portal', False):
|
||||
return False
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if not user.address_id:
|
||||
return False
|
||||
return user.address_id.email
|
||||
return user.user_email
|
||||
|
||||
def _get_default_user(self, cr, uid, context=None):
|
||||
"""Gives current user id
|
||||
|
|
|
@ -48,8 +48,8 @@ this if you want the rule to send an email to the partner."),
|
|||
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from', False), context=None):
|
||||
body = self.format_mail(obj, body)
|
||||
if not emailfrom:
|
||||
if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.address_id and obj.user_id.address_id.email:
|
||||
emailfrom = obj.user_id.address_id.email
|
||||
if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.user_email:
|
||||
emailfrom = obj.user_id.user_email
|
||||
|
||||
name = '[%d] %s' % (obj.id, tools.ustr(obj.name))
|
||||
emailfrom = tools.ustr(emailfrom)
|
||||
|
|
|
@ -164,8 +164,8 @@ class mailgate_thread(osv.osv):
|
|||
'description': details or (hasattr(case, 'description') and case.description or False),
|
||||
'email_to': email,
|
||||
'email_from': email_from or \
|
||||
(hasattr(case, 'user_id') and case.user_id and case.user_id.address_id and \
|
||||
case.user_id.address_id.email),
|
||||
(hasattr(case, 'user_id') and case.user_id and \
|
||||
case.user_id.user_email),
|
||||
'email_cc': email_cc,
|
||||
'email_bcc': email_bcc,
|
||||
'partner_id': partner_id,
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
<tree string="Members">
|
||||
<field name="name"/>
|
||||
<field name="user_email"/>
|
||||
<field name="address_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
|
|
@ -84,8 +84,8 @@ class project_task_close(osv.osv_memory):
|
|||
elif data.manager_warn or data.partner_warn:
|
||||
project = task.project_id
|
||||
subject = _("Task '%s' Closed") % task.name
|
||||
if task.user_id and task.user_id.address_id and task.user_id.address_id.email:
|
||||
from_adr = task.user_id.address_id.email
|
||||
if task.user_id and task.user_id.user_email:
|
||||
from_adr = task.user_id.user_email
|
||||
signature = task.user_id.signature
|
||||
else:
|
||||
raise osv.except_osv(_('Error'), _("Couldn't send mail because your email address is not configured!"))
|
||||
|
|
|
@ -103,7 +103,7 @@ class project_tasks(osv.osv):
|
|||
else:
|
||||
select = ids
|
||||
for task in self.browse(cr, uid, select, context=context):
|
||||
user_email = (task.user_id and task.user_id.address_id and task.user_id.address_id.email) or False
|
||||
user_email = (task.user_id and task.user_id.user_email) or False
|
||||
res += [(user_email, False, False, task.priority)]
|
||||
if isinstance(ids, (str, int, long)):
|
||||
return len(res) and res[0] or False
|
||||
|
|
|
@ -82,7 +82,7 @@ class project_scrum_email(osv.osv_memory):
|
|||
|
||||
email_from = tools.config.get('email_from', False)
|
||||
user = user_pool.browse(cr, uid, uid, context=context)
|
||||
user_email = email_from or user.address_id.email
|
||||
user_email = email_from or user.user_email
|
||||
|
||||
body = "%s\n" %(data.message)
|
||||
body += "\n%s\n" %_('Tasks since yesterday')
|
||||
|
|
|
@ -741,7 +741,7 @@ class survey_request(osv.osv):
|
|||
if user_id:
|
||||
user_obj = self.pool.get('res.users')
|
||||
user = user_obj.browse(cr, uid, user_id, context=context)
|
||||
return {'value': {'email': user.address_id.email}}
|
||||
return {'value': {'email': user.user_email}}
|
||||
return {}
|
||||
|
||||
survey_request()
|
||||
|
|
Loading…
Reference in New Issue