[IMP] Addons: user_email -> email.
bzr revid: tde@openerp.com-20120810144339-30ro9omgfxtjtjyz
This commit is contained in:
parent
7657aedc4e
commit
620b7e9b11
|
@ -38,7 +38,7 @@
|
||||||
<!--Email template -->
|
<!--Email template -->
|
||||||
<record id="email_template_edi_invoice" model="email.template">
|
<record id="email_template_edi_invoice" model="email.template">
|
||||||
<field name="name">Automated Invoice Notification Mail</field>
|
<field name="name">Automated Invoice Notification Mail</field>
|
||||||
<field name="email_from">${object.user_id.user_email or object.company_id.email or 'noreply@localhost'}</field>
|
<field name="email_from">${object.user_id.email or object.company_id.email or 'noreply@localhost'}</field>
|
||||||
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
|
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
|
||||||
<field name="email_to">${object.partner_id.email or ''}</field>
|
<field name="email_to">${object.partner_id.email or ''}</field>
|
||||||
<field name="model_id" ref="account.model_account_invoice"/>
|
<field name="model_id" ref="account.model_account_invoice"/>
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
% if object.origin:
|
% if object.origin:
|
||||||
Order reference: ${object.origin}<br />
|
Order reference: ${object.origin}<br />
|
||||||
% endif
|
% endif
|
||||||
Your contact: <a href="mailto:${object.user_id.user_email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a>
|
Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -133,7 +133,7 @@ A new invoice is available for ${object.partner_id.name}:
|
||||||
% if object.origin:
|
% if object.origin:
|
||||||
| Order reference: ${object.origin}
|
| Order reference: ${object.origin}
|
||||||
% endif
|
% endif
|
||||||
| Your contact: ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
|
| Your contact: ${object.user_id.name} ${object.user_id.email and '<%s>'%(object.user_id.email) or ''}
|
||||||
|
|
||||||
You can view the invoice document, download it and pay online using the following link:
|
You can view the invoice document, download it and pay online using the following link:
|
||||||
${ctx.get('edi_web_url_view') or 'n/a'}
|
${ctx.get('edi_web_url_view') or 'n/a'}
|
||||||
|
@ -160,7 +160,7 @@ Thank you for choosing ${object.company_id.name}!
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
|
${object.user_id.name} ${object.user_id.email and '<%s>'%(object.user_id.email) or ''}
|
||||||
${object.company_id.name}
|
${object.company_id.name}
|
||||||
% if object.company_id.street:
|
% if object.company_id.street:
|
||||||
${object.company_id.street or ''}
|
${object.company_id.street or ''}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class analytic_account(osv.osv):
|
||||||
('name', 'not ilike', 'maintenance'),
|
('name', 'not ilike', 'maintenance'),
|
||||||
('partner_id', '!=', False),
|
('partner_id', '!=', False),
|
||||||
('user_id', '!=', False),
|
('user_id', '!=', False),
|
||||||
('user_id.user_email', '!=', False),
|
('user_id.email', '!=', False),
|
||||||
('state', 'in', ('draft', 'open')),
|
('state', 'in', ('draft', 'open')),
|
||||||
'|', ('date', '<', time.strftime('%Y-%m-%d')), ('date', '=', False),
|
'|', ('date', '<', time.strftime('%Y-%m-%d')), ('date', '=', False),
|
||||||
]
|
]
|
||||||
|
@ -70,7 +70,7 @@ class analytic_account(osv.osv):
|
||||||
for user, data in users.iteritems():
|
for user, data in users.iteritems():
|
||||||
subject = '[OPENERP] Reporting: Analytic Accounts'
|
subject = '[OPENERP] Reporting: Analytic Accounts'
|
||||||
body = Template(MAKO_TEMPLATE).render_unicode(user=user, partners=data)
|
body = Template(MAKO_TEMPLATE).render_unicode(user=user, partners=data)
|
||||||
tools.email_send('noreply@openerp.com', [user.user_email, ], subject, body)
|
tools.email_send('noreply@openerp.com', [user.email, ], subject, body)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ class res_users(osv.Model):
|
||||||
_inherit = 'res.users'
|
_inherit = 'res.users'
|
||||||
|
|
||||||
_sql_constraints = [
|
_sql_constraints = [
|
||||||
('email_uniq', 'UNIQUE (user_email)', 'You can not have two users with the same email!')
|
('email_uniq', 'UNIQUE (email)', 'You can not have two users with the same email!')
|
||||||
]
|
]
|
||||||
|
|
||||||
class signup_signup(osv.TransientModel):
|
class signup_signup(osv.TransientModel):
|
||||||
|
@ -24,7 +24,7 @@ class signup_signup(osv.TransientModel):
|
||||||
new_user = {
|
new_user = {
|
||||||
'name': values['name'],
|
'name': values['name'],
|
||||||
'login': values['email'],
|
'login': values['email'],
|
||||||
'user_email': values['email'],
|
'email': values['email'],
|
||||||
'password': values['password'],
|
'password': values['password'],
|
||||||
'active': True,
|
'active': True,
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,7 +292,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||||
'object_description': hasattr(obj, 'description') and obj.description 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': 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 \
|
'object_user_email': hasattr(obj, 'user_id') and (obj.user_id and \
|
||||||
obj.user_id.user_email) or '/',
|
obj.user_id.email) or '/',
|
||||||
'object_user_phone': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and \
|
'object_user_phone': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and \
|
||||||
obj.partner_address_id.phone) or '/',
|
obj.partner_address_id.phone) or '/',
|
||||||
'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/',
|
'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/',
|
||||||
|
@ -319,8 +319,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||||
mail_message = self.pool.get('mail.message')
|
mail_message = self.pool.get('mail.message')
|
||||||
body = self.format_mail(obj, body)
|
body = self.format_mail(obj, body)
|
||||||
if not emailfrom:
|
if not emailfrom:
|
||||||
if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.user_email:
|
if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.email:
|
||||||
emailfrom = obj.user_id.user_email
|
emailfrom = obj.user_id.email
|
||||||
|
|
||||||
name = '[%d] %s' % (obj.id, tools.ustr(obj.name))
|
name = '[%d] %s' % (obj.id, tools.ustr(obj.name))
|
||||||
emailfrom = tools.ustr(emailfrom)
|
emailfrom = tools.ustr(emailfrom)
|
||||||
|
@ -419,7 +419,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||||
emails = []
|
emails = []
|
||||||
if hasattr(obj, 'user_id') and action.act_mail_to_user:
|
if hasattr(obj, 'user_id') and action.act_mail_to_user:
|
||||||
if obj.user_id:
|
if obj.user_id:
|
||||||
emails.append(obj.user_id.user_email)
|
emails.append(obj.user_id.email)
|
||||||
|
|
||||||
if action.act_mail_to_watchers:
|
if action.act_mail_to_watchers:
|
||||||
emails += (action.act_email_cc or '').split(',')
|
emails += (action.act_email_cc or '').split(',')
|
||||||
|
|
|
@ -57,7 +57,7 @@ class base_stage(object):
|
||||||
if not context or not context.get('portal'):
|
if not context or not context.get('portal'):
|
||||||
return False
|
return False
|
||||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
return user.user_email
|
return user.email
|
||||||
|
|
||||||
def _get_default_user(self, cr, uid, context=None):
|
def _get_default_user(self, cr, uid, context=None):
|
||||||
""" Gives current user id
|
""" Gives current user id
|
||||||
|
@ -301,15 +301,15 @@ class base_stage(object):
|
||||||
for case in self.browse(cr, uid, ids, context=context):
|
for case in self.browse(cr, uid, ids, context=context):
|
||||||
if not destination and not case.email_from:
|
if not destination and not case.email_from:
|
||||||
return False
|
return False
|
||||||
if not case.user_id.user_email:
|
if not case.user_id.email:
|
||||||
return False
|
return False
|
||||||
if destination and case.section_id.user_id:
|
if destination and case.section_id.user_id:
|
||||||
case_email = case.section_id.user_id.user_email
|
case_email = case.section_id.user_id.email
|
||||||
else:
|
else:
|
||||||
case_email = case.user_id.user_email
|
case_email = case.user_id.email
|
||||||
|
|
||||||
src = case_email
|
src = case_email
|
||||||
dest = case.user_id.user_email or ""
|
dest = case.user_id.email or ""
|
||||||
body = case.description or ""
|
body = case.description or ""
|
||||||
for message in case.message_ids:
|
for message in case.message_ids:
|
||||||
if message.email_from and message.body_text:
|
if message.email_from and message.body_text:
|
||||||
|
@ -366,8 +366,8 @@ class base_stage(object):
|
||||||
l=[]
|
l=[]
|
||||||
if case.email_cc:
|
if case.email_cc:
|
||||||
l.append(case.email_cc)
|
l.append(case.email_cc)
|
||||||
if case.user_id and case.user_id.user_email:
|
if case.user_id and case.user_id.email:
|
||||||
l.append(case.user_id.user_email)
|
l.append(case.user_id.email)
|
||||||
res[case.id] = l
|
res[case.id] = l
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class base_state(object):
|
||||||
if not context or not context.get('portal'):
|
if not context or not context.get('portal'):
|
||||||
return False
|
return False
|
||||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
return user.user_email
|
return user.email
|
||||||
|
|
||||||
def _get_default_user(self, cr, uid, context=None):
|
def _get_default_user(self, cr, uid, context=None):
|
||||||
""" Gives current user id
|
""" Gives current user id
|
||||||
|
|
|
@ -49,8 +49,8 @@ class base_action_rule(osv.osv):
|
||||||
mail_message = self.pool.get('mail.message')
|
mail_message = self.pool.get('mail.message')
|
||||||
body = self.format_mail(obj, body)
|
body = self.format_mail(obj, body)
|
||||||
if not emailfrom:
|
if not emailfrom:
|
||||||
if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.user_email:
|
if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.email:
|
||||||
emailfrom = obj.user_id.user_email
|
emailfrom = obj.user_id.email
|
||||||
|
|
||||||
name = '[%d] %s' % (obj.id, tools.ustr(obj.name))
|
name = '[%d] %s' % (obj.id, tools.ustr(obj.name))
|
||||||
emailfrom = tools.ustr(emailfrom)
|
emailfrom = tools.ustr(emailfrom)
|
||||||
|
|
|
@ -243,7 +243,7 @@ class crm_lead(base_stage, osv.osv):
|
||||||
'partner_address_name': fields.related('partner_id', 'name', type='char', string='Partner Contact Name', readonly=True),
|
'partner_address_name': fields.related('partner_id', 'name', type='char', string='Partner Contact Name', readonly=True),
|
||||||
'partner_address_email': fields.related('partner_id', 'email', type='char', string='Partner Contact Email', readonly=True),
|
'partner_address_email': fields.related('partner_id', 'email', type='char', string='Partner Contact Email', readonly=True),
|
||||||
'company_currency': fields.related('company_id', 'currency_id', 'symbol', type='char', string='Company Currency', readonly=True),
|
'company_currency': fields.related('company_id', 'currency_id', 'symbol', type='char', string='Company Currency', readonly=True),
|
||||||
'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
|
'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True),
|
||||||
'user_login': fields.related('user_id', 'login', type='char', string='User Login', readonly=True),
|
'user_login': fields.related('user_id', 'login', type='char', string='User Login', readonly=True),
|
||||||
|
|
||||||
# Fields for address, due to separation from crm and res.partner
|
# Fields for address, due to separation from crm and res.partner
|
||||||
|
@ -692,11 +692,11 @@ class crm_lead(base_stage, osv.osv):
|
||||||
"""
|
"""
|
||||||
#TOFIX: mail template should be used here instead of fix subject, body text.
|
#TOFIX: mail template should be used here instead of fix subject, body text.
|
||||||
message = self.pool.get('mail.message')
|
message = self.pool.get('mail.message')
|
||||||
email_to = lead.user_id and lead.user_id.user_email
|
email_to = lead.user_id and lead.user_id.email
|
||||||
if not email_to:
|
if not email_to:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
email_from = lead.section_id and lead.section_id.user_id and lead.section_id.user_id.user_email or email_to
|
email_from = lead.section_id and lead.section_id.user_id and lead.section_id.user_id.email or email_to
|
||||||
partner = lead.partner_id and lead.partner_id.name or lead.partner_name
|
partner = lead.partner_id and lead.partner_id.name or lead.partner_name
|
||||||
subject = "lead %s converted into opportunity" % lead.name
|
subject = "lead %s converted into opportunity" % lead.name
|
||||||
body = "Info \n Id : %s \n Subject: %s \n Partner: %s \n Description : %s " % (lead.id, lead.name, lead.partner_id.name, lead.description)
|
body = "Info \n Id : %s \n Subject: %s \n Partner: %s \n Description : %s " % (lead.id, lead.name, lead.partner_id.name, lead.description)
|
||||||
|
|
|
@ -43,16 +43,13 @@ class crm_lead_forward_to_partner(osv.osv_memory):
|
||||||
_defaults = {
|
_defaults = {
|
||||||
'send_to' : 'email',
|
'send_to' : 'email',
|
||||||
'history': 'latest',
|
'history': 'latest',
|
||||||
'email_from': lambda self, cr, uid, *a: self.pool.get('res.users')._get_email_from(cr, uid, uid)[uid],
|
'email_from': lambda s, cr, uid, c: s.pool.get('res.users').browse(cr, uid, uid, c).email,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def on_change_email(self, cr, uid, ids, user, context=None):
|
||||||
|
|
||||||
def on_change_email(self, cr, uid, ids, user):
|
|
||||||
if not user:
|
if not user:
|
||||||
return {'value': {'email_to': False}}
|
return {'value': {'email_to': False}}
|
||||||
email = self.pool.get('res.users')._get_email_from(cr, uid, [user])[user]
|
return {'value': {'email_to': self.pool.get('res.users').browse(cr, uid, uid, context=context).email}}
|
||||||
return {'value': {'email_to': email}}
|
|
||||||
|
|
||||||
def on_change_history(self, cr, uid, ids, history_type, context=None):
|
def on_change_history(self, cr, uid, ids, history_type, context=None):
|
||||||
"""Gives message body according to type of history selected
|
"""Gives message body according to type of history selected
|
||||||
|
@ -80,7 +77,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
|
||||||
partner = partner_obj.browse(cr, uid, [partner_id])
|
partner = partner_obj.browse(cr, uid, [partner_id])
|
||||||
user_id = partner and partner[0].user_id or False
|
user_id = partner and partner[0].user_id or False
|
||||||
data.update({'email_from': partner and partner[0].email or "",
|
data.update({'email_from': partner and partner[0].email or "",
|
||||||
'email_cc' : user_id and user_id.user_email or '',
|
'email_cc' : user_id and user_id.user or '',
|
||||||
'user_id': user_id and user_id.id or False})
|
'user_id': user_id and user_id.id or False})
|
||||||
return {'value' : data}
|
return {'value' : data}
|
||||||
|
|
||||||
|
@ -185,7 +182,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
|
||||||
if partner_assigned_id:
|
if partner_assigned_id:
|
||||||
assigned_partner = partner.browse(cr, uid, partner_assigned_id, context=context)
|
assigned_partner = partner.browse(cr, uid, partner_assigned_id, context=context)
|
||||||
user_id = assigned_partner.user_id and assigned_partner.user_id.id or False
|
user_id = assigned_partner.user_id and assigned_partner.user_id.id or False
|
||||||
email_cc = assigned_partner.user_id and assigned_partner.user_id.user_email or ''
|
email_cc = assigned_partner.user_id and assigned_partner.user_id.email or ''
|
||||||
email = assigned_partner.email
|
email = assigned_partner.email
|
||||||
|
|
||||||
res.update({
|
res.update({
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<record id="confirmation_event" model="email.template">
|
<record id="confirmation_event" model="email.template">
|
||||||
<field name="name">Confirmation of the Event</field>
|
<field name="name">Confirmation of the Event</field>
|
||||||
<field name="model_id" ref="event.model_event_registration"/>
|
<field name="model_id" ref="event.model_event_registration"/>
|
||||||
<field name="email_from" >${object.user_id.user_email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'}</field>
|
<field name="email_from" >${object.user_id.email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'}</field>
|
||||||
<field name="email_to" >${object.email}</field>
|
<field name="email_to" >${object.email}</field>
|
||||||
<field name="subject">Your registration at ${object.event_id.name}</field>
|
<field name="subject">Your registration at ${object.event_id.name}</field>
|
||||||
<field name="body_text">
|
<field name="body_text">
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<record id="confirmation_registration" model="email.template">
|
<record id="confirmation_registration" model="email.template">
|
||||||
<field name="name">Confirmation of the Registration</field>
|
<field name="name">Confirmation of the Registration</field>
|
||||||
<field name="model_id" ref="event.model_event_registration"/>
|
<field name="model_id" ref="event.model_event_registration"/>
|
||||||
<field name="email_from" >${object.user_id.user_email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'}</field>
|
<field name="email_from" >${object.user_id.email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'}</field>
|
||||||
<field name="email_to" >${object.email}</field>
|
<field name="email_to" >${object.email}</field>
|
||||||
<field name="subject">Your registration at ${object.event_id.name}</field>
|
<field name="subject">Your registration at ${object.event_id.name}</field>
|
||||||
<field name="body_text">
|
<field name="body_text">
|
||||||
|
|
|
@ -230,7 +230,7 @@ class event_event(osv.osv):
|
||||||
curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', user.id), ('event_id', '=' , ids[0])])
|
curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', user.id), ('event_id', '=' , ids[0])])
|
||||||
#the subscription is done with SUPERUSER_ID because in case we share the kanban view, we want anyone to be able to subscribe
|
#the subscription is done with SUPERUSER_ID because in case we share the kanban view, we want anyone to be able to subscribe
|
||||||
if not curr_reg_ids:
|
if not curr_reg_ids:
|
||||||
curr_reg_ids = [register_pool.create(cr, SUPERUSER_ID, {'event_id': ids[0] ,'email': user.user_email, 'name':user.name, 'user_id': user.id, 'nb_register': num_of_seats})]
|
curr_reg_ids = [register_pool.create(cr, SUPERUSER_ID, {'event_id': ids[0] ,'email': user.email, 'name':user.name, 'user_id': user.id, 'nb_register': num_of_seats})]
|
||||||
else:
|
else:
|
||||||
register_pool.write(cr, uid, curr_reg_ids, {'nb_register': num_of_seats}, context=context)
|
register_pool.write(cr, uid, curr_reg_ids, {'nb_register': num_of_seats}, context=context)
|
||||||
return register_pool.confirm_registration(cr, SUPERUSER_ID, curr_reg_ids, context=context)
|
return register_pool.confirm_registration(cr, SUPERUSER_ID, curr_reg_ids, context=context)
|
||||||
|
|
|
@ -252,7 +252,7 @@ class hr_employee(osv.osv):
|
||||||
def onchange_user(self, cr, uid, ids, user_id, context=None):
|
def onchange_user(self, cr, uid, ids, user_id, context=None):
|
||||||
work_email = False
|
work_email = False
|
||||||
if user_id:
|
if user_id:
|
||||||
work_email = self.pool.get('res.users').browse(cr, uid, user_id, context=context).user_email
|
work_email = self.pool.get('res.users').browse(cr, uid, user_id, context=context).email
|
||||||
return {'value': {'work_email' : work_email}}
|
return {'value': {'work_email' : work_email}}
|
||||||
|
|
||||||
def _get_default_image(self, cr, uid, context=None):
|
def _get_default_image(self, cr, uid, context=None):
|
||||||
|
|
|
@ -228,7 +228,7 @@ class hr_applicant(base_stage, osv.Model):
|
||||||
multi='day_close', type="float", store=True),
|
multi='day_close', type="float", store=True),
|
||||||
'color': fields.integer('Color Index'),
|
'color': fields.integer('Color Index'),
|
||||||
'emp_id': fields.many2one('hr.employee', 'employee'),
|
'emp_id': fields.many2one('hr.employee', 'employee'),
|
||||||
'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
|
'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
<td>
|
<td>
|
||||||
<para style="terp_default_8">[[ user.name ]] </para>
|
<para style="terp_default_8">[[ user.name ]] </para>
|
||||||
<para style="terp_default_8">[[ user.login ]]</para>
|
<para style="terp_default_8">[[ user.login ]]</para>
|
||||||
<para style="terp_default_8">[[ user.user_email ]]</para>
|
<para style="terp_default_8">[[ user.email ]]</para>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</blockTable>
|
</blockTable>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<value>Welcome to OpenERP!</value>
|
<value>Welcome to OpenERP!</value>
|
||||||
<value>Your homepage is a summary of messages you received and key information about documents you follow.
|
<value>Your homepage is a summary of messages you received and key information about documents you follow.
|
||||||
|
|
||||||
The top menu bar contains all applications you installed. You can use this <i>Settings</i> menu to intall more applications, activate others features or give access to new users.
|
The top menu bar contains all applications you installed. You can use this <i>Settings</i> menu to install more applications, activate others features or give access to new users.
|
||||||
|
|
||||||
To setup your preferences (name, email signature, avatar), click on the top right corner.</value>
|
To setup your preferences (name, email signature, avatar), click on the top right corner.</value>
|
||||||
</function>
|
</function>
|
||||||
|
|
|
@ -93,6 +93,9 @@ class mail_message_common(osv.TransientModel):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
|
# name_get may receive int id instead of an id list
|
||||||
|
if isinstance(ids, (int, long)):
|
||||||
|
ids = [ids]
|
||||||
res = []
|
res = []
|
||||||
for message in self.browse(cr, uid, ids, context=context):
|
for message in self.browse(cr, uid, ids, context=context):
|
||||||
name = ''
|
name = ''
|
||||||
|
@ -208,12 +211,13 @@ class mail_message(osv.Model):
|
||||||
'partner_id': fields.many2one('res.partner', 'Related partner',
|
'partner_id': fields.many2one('res.partner', 'Related partner',
|
||||||
help="Deprecated field. Use partner_ids instead."),
|
help="Deprecated field. Use partner_ids instead."),
|
||||||
'partner_ids': fields.many2many('res.partner',
|
'partner_ids': fields.many2many('res.partner',
|
||||||
'mail_message_destination_partner_rel',
|
'mail_message_res_partner_rel',
|
||||||
'message_id', 'partner_id', 'Destination partners',
|
'message_id', 'partner_id', 'Destination partners',
|
||||||
help="When sending emails through the social network composition wizard"\
|
help="When sending emails through the social network composition wizard"\
|
||||||
"you may choose to send a copy of the mail to partners."),
|
"you may choose to send a copy of the mail to partners."),
|
||||||
'user_id': fields.many2one('res.users', 'Related User', readonly=1),
|
'user_id': fields.many2one('res.users', 'Related User', readonly=1),
|
||||||
'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel', 'message_id', 'attachment_id', 'Attachments'),
|
'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel',
|
||||||
|
'message_id', 'attachment_id', 'Attachments'),
|
||||||
'mail_server_id': fields.many2one('ir.mail_server', 'Outgoing mail server', readonly=1),
|
'mail_server_id': fields.many2one('ir.mail_server', 'Outgoing mail server', readonly=1),
|
||||||
'state': fields.selection([
|
'state': fields.selection([
|
||||||
('outgoing', 'Outgoing'),
|
('outgoing', 'Outgoing'),
|
||||||
|
@ -371,7 +375,8 @@ class mail_message(osv.Model):
|
||||||
}
|
}
|
||||||
email_msg_id = self.create(cr, uid, msg_vals, context)
|
email_msg_id = self.create(cr, uid, msg_vals, context)
|
||||||
attachment_ids = []
|
attachment_ids = []
|
||||||
for fname, fcontent in attachments.iteritems():
|
for attachment in attachments:
|
||||||
|
fname, fcontent = attachment
|
||||||
attachment_data = {
|
attachment_data = {
|
||||||
'name': fname,
|
'name': fname,
|
||||||
'datas_fname': fname,
|
'datas_fname': fname,
|
||||||
|
|
|
@ -353,7 +353,7 @@ class mail_thread(osv.Model):
|
||||||
data.update({
|
data.update({
|
||||||
'email_to': email_to,
|
'email_to': email_to,
|
||||||
'email_from': email_from or \
|
'email_from': email_from or \
|
||||||
(hasattr(thread, 'user_id') and thread.user_id and thread.user_id.user_email),
|
(hasattr(thread, 'user_id') and thread.user_id and thread.user_id.email),
|
||||||
'email_cc': email_cc,
|
'email_cc': email_cc,
|
||||||
'email_bcc': email_bcc,
|
'email_bcc': email_bcc,
|
||||||
'references': references,
|
'references': references,
|
||||||
|
@ -771,7 +771,7 @@ class mail_thread(osv.Model):
|
||||||
for thread in self.browse(cr, uid, ids, context=context):
|
for thread in self.browse(cr, uid, ids, context=context):
|
||||||
l = set()
|
l = set()
|
||||||
for message in thread.message_ids:
|
for message in thread.message_ids:
|
||||||
l.add((message.user_id and message.user_id.user_email) or '')
|
l.add((message.user_id and message.user_id.email) or '')
|
||||||
l.add(message.email_from or '')
|
l.add(message.email_from or '')
|
||||||
l.add(message.email_cc or '')
|
l.add(message.email_cc or '')
|
||||||
res[thread.id] = filter(None, l)
|
res[thread.id] = filter(None, l)
|
||||||
|
@ -985,9 +985,9 @@ class mail_thread(osv.Model):
|
||||||
if not user.notification_email_pref == 'all' and \
|
if not user.notification_email_pref == 'all' and \
|
||||||
not (user.notification_email_pref == 'to_me' and user.id in user_to_push_from_parse_ids):
|
not (user.notification_email_pref == 'to_me' and user.id in user_to_push_from_parse_ids):
|
||||||
continue
|
continue
|
||||||
if not user.user_email:
|
if not user.email:
|
||||||
continue
|
continue
|
||||||
email_to = '%s, %s' % (email_to, user.user_email)
|
email_to = '%s, %s' % (email_to, user.email)
|
||||||
email_to = email_to.lstrip(', ')
|
email_to = email_to.lstrip(', ')
|
||||||
|
|
||||||
# did not find any email address: not necessary to create an email
|
# did not find any email address: not necessary to create an email
|
||||||
|
@ -998,7 +998,7 @@ class mail_thread(osv.Model):
|
||||||
current_user = res_users_obj.browse(cr, uid, [uid], context=context)[0]
|
current_user = res_users_obj.browse(cr, uid, [uid], context=context)[0]
|
||||||
email_from = new_msg_values.get('email_from')
|
email_from = new_msg_values.get('email_from')
|
||||||
if not email_from:
|
if not email_from:
|
||||||
email_from = current_user.user_email
|
email_from = current_user.email
|
||||||
|
|
||||||
# get email content, create it (with mail_message.create)
|
# get email content, create it (with mail_message.create)
|
||||||
email_values = self.message_create_notify_get_email_dict(cr, uid, new_msg_values, email_from, email_to, context)
|
email_values = self.message_create_notify_get_email_dict(cr, uid, new_msg_values, email_from, email_to, context)
|
||||||
|
|
|
@ -40,9 +40,8 @@ class res_users(osv.osv):
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'notification_email_pref': fields.selection([
|
'notification_email_pref': fields.selection([
|
||||||
('all', 'All feeds'),
|
('all', 'All Feeds'),
|
||||||
('comments', 'Only comments'),
|
('to_me', 'Only send directly to me'),
|
||||||
('to_me', 'Only when sent directly to me'),
|
|
||||||
('none', 'Never')
|
('none', 'Never')
|
||||||
], 'Receive Feeds by Email', required=True,
|
], 'Receive Feeds by Email', required=True,
|
||||||
help="Choose in which case you want to receive an email when you "\
|
help="Choose in which case you want to receive an email when you "\
|
||||||
|
@ -101,8 +100,14 @@ class res_users(osv.osv):
|
||||||
self.message_subscribe(cr, uid, [user_id], [user_id], context=context)
|
self.message_subscribe(cr, uid, [user_id], [user_id], context=context)
|
||||||
# create a welcome message
|
# create a welcome message
|
||||||
company_name = user.company_id.name if user.company_id else _('the company')
|
company_name = user.company_id.name if user.company_id else _('the company')
|
||||||
message = _('%s joined the %s network! Take a moment to welcome %s.') % (user.name, company_name, user.name)
|
message = '''%s has joined %s! Welcome in OpenERP !
|
||||||
self.message_append_note(cr, uid, [user_id], body=message, type='comment', context=context)
|
|
||||||
|
Your homepage is a summary of messages you received and key information about documents you follow.
|
||||||
|
|
||||||
|
The top menu bar contains all applications you installed. You can use this <i>Settings</i> menu to install more applications, activate others features or give access to new users.
|
||||||
|
|
||||||
|
To setup your preferences (name, email signature, avatar), click on the top right corner.''' % (user.name, company_name)
|
||||||
|
self.message_append_note(cr, uid, [user_id], subject='Welcome to OpenERP', body=message, type='comment', content_subtype='html', context=context)
|
||||||
return user_id
|
return user_id
|
||||||
|
|
||||||
def write(self, cr, uid, ids, vals, context=None):
|
def write(self, cr, uid, ids, vals, context=None):
|
||||||
|
|
|
@ -100,7 +100,7 @@ class mail_compose_message(osv.TransientModel):
|
||||||
# Try to provide default email_from if not specified yet
|
# Try to provide default email_from if not specified yet
|
||||||
if not result.get('email_from'):
|
if not result.get('email_from'):
|
||||||
current_user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
current_user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
result['email_from'] = current_user.user_email or False
|
result['email_from'] = current_user.email or False
|
||||||
return result
|
return result
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
|
@ -133,7 +133,7 @@ class mail_compose_message(osv.TransientModel):
|
||||||
result.update({
|
result.update({
|
||||||
'model': model,
|
'model': model,
|
||||||
'res_id': res_id,
|
'res_id': res_id,
|
||||||
'email_from': user.user_email or tools.config.get('email_from', False),
|
'email_from': user.email or tools.config.get('email_from', False),
|
||||||
'body_html': False,
|
'body_html': False,
|
||||||
'body_text': False,
|
'body_text': False,
|
||||||
'subject': False,
|
'subject': False,
|
||||||
|
@ -223,7 +223,7 @@ class mail_compose_message(osv.TransientModel):
|
||||||
'dest_partner_ids': dest_partner_ids,
|
'dest_partner_ids': dest_partner_ids,
|
||||||
'model': message_data.model or False,
|
'model': message_data.model or False,
|
||||||
'res_id': message_data.res_id or False,
|
'res_id': message_data.res_id or False,
|
||||||
'email_from': current_user.user_email or message_data.email_to or False,
|
'email_from': current_user.email or message_data.email_to or False,
|
||||||
'email_to': message_data.reply_to or message_data.email_from or False,
|
'email_to': message_data.reply_to or message_data.email_from or False,
|
||||||
'email_cc': message_data.email_cc or False,
|
'email_cc': message_data.email_cc or False,
|
||||||
'user_id': uid,
|
'user_id': uid,
|
||||||
|
|
|
@ -50,7 +50,7 @@ class crm_contact_us(osv.TransientModel):
|
||||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
|
|
||||||
if (user.login != 'anonymous'):
|
if (user.login != 'anonymous'):
|
||||||
return user.user_email
|
return user.email
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -794,7 +794,7 @@ class task(base_stage, osv.osv):
|
||||||
'company_id': fields.many2one('res.company', 'Company'),
|
'company_id': fields.many2one('res.company', 'Company'),
|
||||||
'id': fields.integer('ID', readonly=True),
|
'id': fields.integer('ID', readonly=True),
|
||||||
'color': fields.integer('Color Index'),
|
'color': fields.integer('Color Index'),
|
||||||
'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
|
'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True),
|
||||||
}
|
}
|
||||||
|
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
|
|
@ -256,7 +256,7 @@ class project_issue(base_stage, osv.osv):
|
||||||
'inactivity_days': fields.function(_compute_day, string='Days since last action', \
|
'inactivity_days': fields.function(_compute_day, string='Days since last action', \
|
||||||
multi='compute_day', type="integer", help="Difference in days between last action and current date"),
|
multi='compute_day', type="integer", help="Difference in days between last action and current date"),
|
||||||
'color': fields.integer('Color Index'),
|
'color': fields.integer('Color Index'),
|
||||||
'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
|
'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True),
|
||||||
'date_action_last': fields.datetime('Last Action', readonly=1),
|
'date_action_last': fields.datetime('Last Action', readonly=1),
|
||||||
'date_action_next': fields.datetime('Next Action', readonly=1),
|
'date_action_next': fields.datetime('Next Action', readonly=1),
|
||||||
'progress': fields.function(_hours_get, string='Progress (%)', multi='hours', group_operator="avg", help="Computed as: Time Spent / Total Time.",
|
'progress': fields.function(_hours_get, string='Progress (%)', multi='hours', group_operator="avg", help="Computed as: Time Spent / Total Time.",
|
||||||
|
|
|
@ -73,7 +73,7 @@ class project_tasks(osv.osv):
|
||||||
followers = super(project_tasks,self).message_thread_followers(cr, uid, ids, context=context)
|
followers = super(project_tasks,self).message_thread_followers(cr, uid, ids, context=context)
|
||||||
for task in self.browse(cr, uid, followers.keys(), context=context):
|
for task in self.browse(cr, uid, followers.keys(), context=context):
|
||||||
task_followers = set(followers[task.id])
|
task_followers = set(followers[task.id])
|
||||||
task_followers.add(task.user_id.user_email)
|
task_followers.add(task.user_id.email)
|
||||||
followers[task.id] = filter(None, task_followers)
|
followers[task.id] = filter(None, task_followers)
|
||||||
return followers
|
return followers
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<!--Email template -->
|
<!--Email template -->
|
||||||
<record id="email_template_edi_purchase" model="email.template">
|
<record id="email_template_edi_purchase" model="email.template">
|
||||||
<field name="name">Automated Purchase Order Notification Mail</field>
|
<field name="name">Automated Purchase Order Notification Mail</field>
|
||||||
<field name="email_from">${object.validator.user_email or ''}</field>
|
<field name="email_from">${object.validator.email or ''}</field>
|
||||||
<field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
|
<field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
|
||||||
<field name="email_to">${object.partner_id.email}</field>
|
<field name="email_to">${object.partner_id.email}</field>
|
||||||
<field name="model_id" ref="purchase.model_purchase_order"/>
|
<field name="model_id" ref="purchase.model_purchase_order"/>
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
% if object.partner_ref:
|
% if object.partner_ref:
|
||||||
Your reference: ${object.partner_ref}<br />
|
Your reference: ${object.partner_ref}<br />
|
||||||
% endif
|
% endif
|
||||||
Your contact: <a href="mailto:${object.validator.user_email or ''}?subject=Order%20${object.name}">${object.validator.name}</a>
|
Your contact: <a href="mailto:${object.validator.email or ''}?subject=Order%20${object.name}">${object.validator.name}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -121,7 +121,7 @@ Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'pu
|
||||||
% if object.partner_ref:
|
% if object.partner_ref:
|
||||||
| Your reference: ${object.partner_ref}<br />
|
| Your reference: ${object.partner_ref}<br />
|
||||||
% endif
|
% endif
|
||||||
| Your contact: ${object.validator.name} ${object.validator.user_email and '<%s>'%(object.validator.user_email) or ''}
|
| Your contact: ${object.validator.name} ${object.validator.email and '<%s>'%(object.validator.email) or ''}
|
||||||
|
|
||||||
You can view the ${object.state in ('draft', 'sent') and 'request for quotation' or 'order confirmation'} and download it using the following link:
|
You can view the ${object.state in ('draft', 'sent') and 'request for quotation' or 'order confirmation'} and download it using the following link:
|
||||||
${ctx.get('edi_web_url_view') or 'n/a'}
|
${ctx.get('edi_web_url_view') or 'n/a'}
|
||||||
|
@ -132,7 +132,7 @@ Thank you!
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
${object.validator.name} ${object.validator.user_email and '<%s>'%(object.validator.user_email) or ''}
|
${object.validator.name} ${object.validator.email and '<%s>'%(object.validator.email) or ''}
|
||||||
${object.company_id.name}
|
${object.company_id.name}
|
||||||
% if object.company_id.street:
|
% if object.company_id.street:
|
||||||
${object.company_id.street or ''}
|
${object.company_id.street or ''}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<!--Email template -->
|
<!--Email template -->
|
||||||
<record id="email_template_edi_sale" model="email.template">
|
<record id="email_template_edi_sale" model="email.template">
|
||||||
<field name="name">Automated Sale Order Notification Mail</field>
|
<field name="name">Automated Sale Order Notification Mail</field>
|
||||||
<field name="email_from">${object.user_id.user_email or ''}</field>
|
<field name="email_from">${object.user_id.email or ''}</field>
|
||||||
<field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
|
<field name="subject">${object.company_id.name} Order (Ref ${object.name or 'n/a' })</field>
|
||||||
<field name="email_to">${object.partner_invoice_id.email}</field>
|
<field name="email_to">${object.partner_invoice_id.email}</field>
|
||||||
<field name="model_id" ref="sale.model_sale_order"/>
|
<field name="model_id" ref="sale.model_sale_order"/>
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
% if object.client_order_ref:
|
% if object.client_order_ref:
|
||||||
Your reference: ${object.client_order_ref}<br />
|
Your reference: ${object.client_order_ref}<br />
|
||||||
% endif
|
% endif
|
||||||
Your contact: <a href="mailto:${object.user_id.user_email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a>
|
Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Order%20${object.name}">${object.user_id.name}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -139,7 +139,7 @@ Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confi
|
||||||
% if object.client_order_ref:
|
% if object.client_order_ref:
|
||||||
| Your reference: ${object.client_order_ref}<br />
|
| Your reference: ${object.client_order_ref}<br />
|
||||||
% endif
|
% endif
|
||||||
| Your contact: ${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
|
| Your contact: ${object.user_id.name} ${object.user_id.email and '<%s>'%(object.user_id.email) or ''}
|
||||||
|
|
||||||
You can view the ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'}, download it and even pay online using the following link:
|
You can view the ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'}, download it and even pay online using the following link:
|
||||||
${ctx.get('edi_web_url_view') or 'n/a'}
|
${ctx.get('edi_web_url_view') or 'n/a'}
|
||||||
|
@ -166,7 +166,7 @@ Thank you for choosing ${object.company_id.name}!
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
${object.user_id.name} ${object.user_id.user_email and '<%s>'%(object.user_id.user_email) or ''}
|
${object.user_id.name} ${object.user_id.email and '<%s>'%(object.user_id.email) or ''}
|
||||||
${object.company_id.name}
|
${object.company_id.name}
|
||||||
% if object.company_id.street:
|
% if object.company_id.street:
|
||||||
${object.company_id.street or ''}
|
${object.company_id.street or ''}
|
||||||
|
|
|
@ -196,7 +196,7 @@ class share_wizard(osv.TransientModel):
|
||||||
}
|
}
|
||||||
|
|
||||||
def has_email(self, cr, uid, context=None):
|
def has_email(self, cr, uid, context=None):
|
||||||
return bool(self.pool.get('res.users').browse(cr, uid, uid, context=context).user_email)
|
return bool(self.pool.get('res.users').browse(cr, uid, uid, context=context).email)
|
||||||
|
|
||||||
def go_step_1(self, cr, uid, ids, context=None):
|
def go_step_1(self, cr, uid, ids, context=None):
|
||||||
wizard_data = self.browse(cr,uid,ids,context)[0]
|
wizard_data = self.browse(cr,uid,ids,context)[0]
|
||||||
|
@ -241,7 +241,7 @@ class share_wizard(osv.TransientModel):
|
||||||
if not wizard_data.invite:
|
if not wizard_data.invite:
|
||||||
existing = user_obj.search(cr, UID_ROOT, [('login', '=', new_user)])
|
existing = user_obj.search(cr, UID_ROOT, [('login', '=', new_user)])
|
||||||
else:
|
else:
|
||||||
existing = user_obj.search(cr, UID_ROOT, [('user_email', '=', new_user)])
|
existing = user_obj.search(cr, UID_ROOT, [('email', '=', new_user)])
|
||||||
existing_ids.extend(existing)
|
existing_ids.extend(existing)
|
||||||
if existing:
|
if existing:
|
||||||
new_line = { 'user_id': existing[0],
|
new_line = { 'user_id': existing[0],
|
||||||
|
@ -253,7 +253,7 @@ class share_wizard(osv.TransientModel):
|
||||||
'login': new_user,
|
'login': new_user,
|
||||||
'password': new_pass,
|
'password': new_pass,
|
||||||
'name': new_user,
|
'name': new_user,
|
||||||
'user_email': new_user,
|
'email': new_user,
|
||||||
'groups_id': [(6,0,[group_id])],
|
'groups_id': [(6,0,[group_id])],
|
||||||
'share': True,
|
'share': True,
|
||||||
'message_email_pref': 'all',
|
'message_email_pref': 'all',
|
||||||
|
@ -825,12 +825,12 @@ class share_wizard(osv.TransientModel):
|
||||||
message_obj = self.pool.get('mail.message')
|
message_obj = self.pool.get('mail.message')
|
||||||
notification_obj = self.pool.get('mail.notification')
|
notification_obj = self.pool.get('mail.notification')
|
||||||
user = self.pool.get('res.users').browse(cr, UID_ROOT, uid)
|
user = self.pool.get('res.users').browse(cr, UID_ROOT, uid)
|
||||||
if not user.user_email:
|
if not user.email:
|
||||||
raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.'))
|
raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.'))
|
||||||
|
|
||||||
# TODO: also send an HTML version of this mail
|
# TODO: also send an HTML version of this mail
|
||||||
for result_line in wizard_data.result_line_ids:
|
for result_line in wizard_data.result_line_ids:
|
||||||
email_to = result_line.user_id.user_email
|
email_to = result_line.user_id.email
|
||||||
if not email_to:
|
if not email_to:
|
||||||
continue
|
continue
|
||||||
subject = _('Invitation to collaborate about %s') % (wizard_data.record_name)
|
subject = _('Invitation to collaborate about %s') % (wizard_data.record_name)
|
||||||
|
@ -849,20 +849,20 @@ class share_wizard(osv.TransientModel):
|
||||||
body += "--\n"
|
body += "--\n"
|
||||||
body += _("OpenERP is a powerful and user-friendly suite of Business Applications (CRM, Sales, HR, etc.)\n"
|
body += _("OpenERP is a powerful and user-friendly suite of Business Applications (CRM, Sales, HR, etc.)\n"
|
||||||
"It is open source and can be found on http://www.openerp.com.")
|
"It is open source and can be found on http://www.openerp.com.")
|
||||||
msg_id = message_obj.schedule_with_attach(cr, uid, user.user_email, [email_to], subject, body, model='', context=context)
|
msg_id = message_obj.schedule_with_attach(cr, uid, user.email, [email_to], subject, body, model='', context=context)
|
||||||
notification_obj.create(cr, uid, {'user_id': result_line.user_id.id, 'message_id': msg_id}, context=context)
|
notification_obj.create(cr, uid, {'user_id': result_line.user_id.id, 'message_id': msg_id}, context=context)
|
||||||
|
|
||||||
def send_emails(self, cr, uid, wizard_data, context=None):
|
def send_emails(self, cr, uid, wizard_data, context=None):
|
||||||
_logger.info('Sending share notifications by email...')
|
_logger.info('Sending share notifications by email...')
|
||||||
mail_message = self.pool.get('mail.message')
|
mail_message = self.pool.get('mail.message')
|
||||||
user = self.pool.get('res.users').browse(cr, UID_ROOT, uid)
|
user = self.pool.get('res.users').browse(cr, UID_ROOT, uid)
|
||||||
if not user.user_email:
|
if not user.email:
|
||||||
raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.'))
|
raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.'))
|
||||||
|
|
||||||
# TODO: also send an HTML version of this mail
|
# TODO: also send an HTML version of this mail
|
||||||
msg_ids = []
|
msg_ids = []
|
||||||
for result_line in wizard_data.result_line_ids:
|
for result_line in wizard_data.result_line_ids:
|
||||||
email_to = result_line.user_id.user_email
|
email_to = result_line.user_id.email
|
||||||
if not email_to:
|
if not email_to:
|
||||||
continue
|
continue
|
||||||
subject = wizard_data.name
|
subject = wizard_data.name
|
||||||
|
@ -883,7 +883,7 @@ class share_wizard(osv.TransientModel):
|
||||||
body += "--\n"
|
body += "--\n"
|
||||||
body += _("OpenERP is a powerful and user-friendly suite of Business Applications (CRM, Sales, HR, etc.)\n"
|
body += _("OpenERP is a powerful and user-friendly suite of Business Applications (CRM, Sales, HR, etc.)\n"
|
||||||
"It is open source and can be found on http://www.openerp.com.")
|
"It is open source and can be found on http://www.openerp.com.")
|
||||||
msg_ids.append(mail_message.schedule_with_attach(cr, uid, user.user_email, [email_to], subject, body, model='share.wizard', context=context))
|
msg_ids.append(mail_message.schedule_with_attach(cr, uid, user.email, [email_to], subject, body, model='share.wizard', context=context))
|
||||||
# force direct delivery, as users expect instant notification
|
# force direct delivery, as users expect instant notification
|
||||||
mail_message.send(cr, uid, msg_ids, context=context)
|
mail_message.send(cr, uid, msg_ids, context=context)
|
||||||
_logger.info('%d share notification(s) sent.', len(msg_ids))
|
_logger.info('%d share notification(s) sent.', len(msg_ids))
|
||||||
|
|
|
@ -740,7 +740,7 @@ class survey_request(osv.osv):
|
||||||
if user_id:
|
if user_id:
|
||||||
user_obj = self.pool.get('res.users')
|
user_obj = self.pool.get('res.users')
|
||||||
user = user_obj.browse(cr, uid, user_id, context=context)
|
user = user_obj.browse(cr, uid, user_id, context=context)
|
||||||
return {'value': {'email': user.user_email}}
|
return {'value': {'email': user.email}}
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
survey_request()
|
survey_request()
|
||||||
|
|
|
@ -414,8 +414,8 @@ class survey_question_wiz(osv.osv_memory):
|
||||||
file.close()
|
file.close()
|
||||||
os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
|
os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
|
||||||
|
|
||||||
user_email = user_obj.browse(cr, uid, uid, context).user_email
|
user_email = user_obj.browse(cr, uid, uid, context).email
|
||||||
resp_email = survey_data.responsible_id and survey_data.responsible_id.user_email or False
|
resp_email = survey_data.responsible_id and survey_data.responsible_id.email or False
|
||||||
|
|
||||||
if user_email and resp_email:
|
if user_email and resp_email:
|
||||||
user_name = user_obj.browse(cr, uid, uid, context=context).name
|
user_name = user_obj.browse(cr, uid, uid, context=context).name
|
||||||
|
|
Loading…
Reference in New Issue