From 176728a64451a5d3f67e893041548c620ac469bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Fri, 10 Aug 2012 10:49:06 +0200
Subject: [PATCH 01/24] [REF] portal wizard: _lang_get coming from res_partner,
not res.users anymore.
bzr revid: tde@openerp.com-20120810084906-cs7wrc7aen1v2itp
---
addons/portal/wizard/portal_wizard.py | 30 +++++++++++++--------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py
index 64e24e408dd..0260ce338fc 100644
--- a/addons/portal/wizard/portal_wizard.py
+++ b/addons/portal/wizard/portal_wizard.py
@@ -26,7 +26,7 @@ from osv import osv, fields
from tools.misc import email_re
from tools.translate import _
-from base.res.res_users import _lang_get
+from base.res.res_partner import _lang_get
_logger = logging.getLogger(__name__)
@@ -62,9 +62,9 @@ def random_password():
random.shuffle(chars)
return ''.join(chars)
-def extract_email(user_email):
+def extract_email(email):
""" extract the email address from a user-friendly email address """
- m = email_re.search(user_email or "")
+ m = email_re.search(email or "")
return m and m.group(0) or ""
@@ -102,7 +102,7 @@ class wizard(osv.osv_memory):
return{
'name': address.name,
- 'user_email': extract_email(address.email),
+ 'email': extract_email(address.email),
'lang': lang,
'partner_id': partner_id,
}
@@ -136,7 +136,7 @@ class wizard(osv.osv_memory):
user_obj = self.pool.get('res.users')
user = user_obj.browse(cr, ROOT_UID, uid, context0)
- if not user.user_email:
+ if not user.email:
raise osv.except_osv(_('Email required'),
_('You must have an email address in your User Preferences'
' to send emails.'))
@@ -144,7 +144,7 @@ class wizard(osv.osv_memory):
portal_obj = self.pool.get('res.portal')
for wiz in self.browse(cr, uid, ids, context):
# determine existing users
- login_cond = [('login', 'in', [u.user_email for u in wiz.user_ids])]
+ login_cond = [('login', 'in', [u.email for u in wiz.user_ids])]
existing_uids = user_obj.search(cr, ROOT_UID, login_cond)
existing_users = user_obj.browse(cr, ROOT_UID, existing_uids)
existing_logins = [u.login for u in existing_users]
@@ -152,15 +152,15 @@ class wizard(osv.osv_memory):
# create new users in portal (skip existing logins)
new_users_data = [ {
'name': u.name,
- 'login': u.user_email,
+ 'login': u.email,
'password': random_password(),
- 'user_email': u.user_email,
- 'context_lang': u.lang,
+ 'email': u.email,
+ 'lang': u.lang,
'share': True,
'action_id': wiz.portal_id.home_action_id and wiz.portal_id.home_action_id.id or False,
'partner_id': u.partner_id and u.partner_id.id,
'groups_id': [(6, 0, [])],
- } for u in wiz.user_ids if u.user_email not in existing_logins ]
+ } for u in wiz.user_ids if u.email not in existing_logins ]
portal_obj.write(cr, ROOT_UID, [wiz.portal_id.id],
{'users': [(0, 0, data) for data in new_users_data]}, context0)
@@ -175,13 +175,13 @@ class wizard(osv.osv_memory):
dest_uids = user_obj.search(cr, ROOT_UID, login_cond)
dest_users = user_obj.browse(cr, ROOT_UID, dest_uids)
for dest_user in dest_users:
- context['lang'] = dest_user.context_lang
+ context['lang'] = dest_user.lang
data['login'] = dest_user.login
data['password'] = dest_user.password
data['name'] = dest_user.name
- email_from = user.user_email
- email_to = dest_user.user_email
+ email_from = user.email
+ email_to = dest_user.email
subject = _(WELCOME_EMAIL_SUBJECT) % data
body = _(WELCOME_EMAIL_BODY) % data
res = mail_message_obj.schedule_with_attach(cr, uid, email_from , [email_to], subject, body, context=context)
@@ -208,7 +208,7 @@ class wizard_user(osv.osv_memory):
'name': fields.char(size=64, required=True,
string='User Name',
help="The user's real name"),
- 'user_email': fields.char(size=64, required=True,
+ 'email': fields.char(size=64, required=True,
string='Email',
help="Will be used as user login. "
"Also necessary to send the account information to new users"),
@@ -222,7 +222,7 @@ class wizard_user(osv.osv_memory):
def _check_email(self, cr, uid, ids):
""" check syntax of email address """
for wuser in self.browse(cr, uid, ids):
- if not email_re.match(wuser.user_email): return False
+ if not email_re.match(wuser.email): return False
return True
_constraints = [
From e9d6d69993ef459aa54973396255d54f6785b8c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Fri, 10 Aug 2012 11:27:06 +0200
Subject: [PATCH 02/24] [REF] view inheriting from res.users: user_email ->
email.
bzr revid: tde@openerp.com-20120810092706-538ot71bfqzkk3rg
---
addons/portal/wizard/portal_wizard_view.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/portal/wizard/portal_wizard_view.xml b/addons/portal/wizard/portal_wizard_view.xml
index 55a8404f54b..e78bbaad266 100644
--- a/addons/portal/wizard/portal_wizard_view.xml
+++ b/addons/portal/wizard/portal_wizard_view.xml
@@ -43,7 +43,7 @@
editable in the web client 6.0 -->
-
+
@@ -58,7 +58,7 @@
@@ -133,7 +133,7 @@ A new invoice is available for ${object.partner_id.name}:
% if object.origin:
| Order reference: ${object.origin}
% 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:
${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}
% if object.company_id.street:
${object.company_id.street or ''}
diff --git a/addons/account_analytic_analysis/cron_account_analytic_account.py b/addons/account_analytic_analysis/cron_account_analytic_account.py
index caa9067b227..065fdc5b907 100644
--- a/addons/account_analytic_analysis/cron_account_analytic_account.py
+++ b/addons/account_analytic_analysis/cron_account_analytic_account.py
@@ -53,7 +53,7 @@ class analytic_account(osv.osv):
('name', 'not ilike', 'maintenance'),
('partner_id', '!=', False),
('user_id', '!=', False),
- ('user_id.user_email', '!=', False),
+ ('user_id.email', '!=', False),
('state', 'in', ('draft', 'open')),
'|', ('date', '<', time.strftime('%Y-%m-%d')), ('date', '=', False),
]
@@ -70,7 +70,7 @@ class analytic_account(osv.osv):
for user, data in users.iteritems():
subject = '[OPENERP] Reporting: Analytic Accounts'
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
diff --git a/addons/auth_signup/auth_signup.py b/addons/auth_signup/auth_signup.py
index ebc72b3aeac..fedce607206 100644
--- a/addons/auth_signup/auth_signup.py
+++ b/addons/auth_signup/auth_signup.py
@@ -4,7 +4,7 @@ class res_users(osv.Model):
_inherit = 'res.users'
_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):
@@ -24,7 +24,7 @@ class signup_signup(osv.TransientModel):
new_user = {
'name': values['name'],
'login': values['email'],
- 'user_email': values['email'],
+ 'email': values['email'],
'password': values['password'],
'active': True,
}
diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py
index 7699256985c..b6eacda63c0 100644
--- a/addons/base_action_rule/base_action_rule.py
+++ b/addons/base_action_rule/base_action_rule.py
@@ -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_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.user_email) or '/',
+ obj.user_id.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 '/',
@@ -319,8 +319,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
mail_message = self.pool.get('mail.message')
body = self.format_mail(obj, body)
if not emailfrom:
- if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.user_email:
- emailfrom = obj.user_id.user_email
+ if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.email:
+ emailfrom = obj.user_id.email
name = '[%d] %s' % (obj.id, tools.ustr(obj.name))
emailfrom = tools.ustr(emailfrom)
@@ -419,7 +419,7 @@ 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:
- emails.append(obj.user_id.user_email)
+ emails.append(obj.user_id.email)
if action.act_mail_to_watchers:
emails += (action.act_email_cc or '').split(',')
diff --git a/addons/base_status/base_stage.py b/addons/base_status/base_stage.py
index 44e9de89162..775de51394c 100644
--- a/addons/base_status/base_stage.py
+++ b/addons/base_status/base_stage.py
@@ -57,7 +57,7 @@ class base_stage(object):
if not context or not context.get('portal'):
return False
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):
""" Gives current user id
@@ -301,15 +301,15 @@ class base_stage(object):
for case in self.browse(cr, uid, ids, context=context):
if not destination and not case.email_from:
return False
- if not case.user_id.user_email:
+ if not case.user_id.email:
return False
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:
- case_email = case.user_id.user_email
+ case_email = case.user_id.email
src = case_email
- dest = case.user_id.user_email or ""
+ dest = case.user_id.email or ""
body = case.description or ""
for message in case.message_ids:
if message.email_from and message.body_text:
@@ -366,8 +366,8 @@ class base_stage(object):
l=[]
if case.email_cc:
l.append(case.email_cc)
- if case.user_id and case.user_id.user_email:
- l.append(case.user_id.user_email)
+ if case.user_id and case.user_id.email:
+ l.append(case.user_id.email)
res[case.id] = l
return res
diff --git a/addons/base_status/base_state.py b/addons/base_status/base_state.py
index 4247e67f435..8fa2f92e22a 100644
--- a/addons/base_status/base_state.py
+++ b/addons/base_status/base_state.py
@@ -55,7 +55,7 @@ class base_state(object):
if not context or not context.get('portal'):
return False
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):
""" Gives current user id
diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py
index 96d182113c8..3e3bdc90d08 100644
--- a/addons/crm/crm_action_rule.py
+++ b/addons/crm/crm_action_rule.py
@@ -49,8 +49,8 @@ class base_action_rule(osv.osv):
mail_message = self.pool.get('mail.message')
body = self.format_mail(obj, body)
if not emailfrom:
- if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.user_email:
- emailfrom = obj.user_id.user_email
+ if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.email:
+ emailfrom = obj.user_id.email
name = '[%d] %s' % (obj.id, tools.ustr(obj.name))
emailfrom = tools.ustr(emailfrom)
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 29d3eefec70..451dd795a94 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -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_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),
- '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),
# 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.
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:
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
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)
diff --git a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
index 2bc2d67d00a..d479f8b1bd5 100644
--- a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
+++ b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
@@ -43,16 +43,13 @@ class crm_lead_forward_to_partner(osv.osv_memory):
_defaults = {
'send_to' : 'email',
'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):
+ def on_change_email(self, cr, uid, ids, user, context=None):
if not user:
return {'value': {'email_to': False}}
- email = self.pool.get('res.users')._get_email_from(cr, uid, [user])[user]
- return {'value': {'email_to': email}}
+ return {'value': {'email_to': self.pool.get('res.users').browse(cr, uid, uid, context=context).email}}
def on_change_history(self, cr, uid, ids, history_type, context=None):
"""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])
user_id = partner and partner[0].user_id or False
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})
return {'value' : data}
@@ -185,7 +182,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
if partner_assigned_id:
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
- 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
res.update({
diff --git a/addons/event/email_template.xml b/addons/event/email_template.xml
index 4485dfc785a..2666ece9921 100644
--- a/addons/event/email_template.xml
+++ b/addons/event/email_template.xml
@@ -4,7 +4,7 @@
Confirmation of the Event
- ${object.user_id.user_email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'}
+ ${object.user_id.email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'}
${object.email}
Your registration at ${object.event_id.name}
@@ -24,7 +24,7 @@
Confirmation of the Registration
- ${object.user_id.user_email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'}
+ ${object.user_id.email or object.company_id.email or 'noreply@' + object.company_id.name + '.com'}
${object.email}
Your registration at ${object.event_id.name}
diff --git a/addons/event/event.py b/addons/event/event.py
index 4279b8fcd7e..7f0c77661e4 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -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])])
#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:
- 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:
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)
diff --git a/addons/hr/hr.py b/addons/hr/hr.py
index 47432e1f527..966c29cab07 100644
--- a/addons/hr/hr.py
+++ b/addons/hr/hr.py
@@ -252,7 +252,7 @@ class hr_employee(osv.osv):
def onchange_user(self, cr, uid, ids, user_id, context=None):
work_email = False
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}}
def _get_default_image(self, cr, uid, context=None):
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 1db79172dc5..ee85ecc22a3 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -228,7 +228,7 @@ class hr_applicant(base_stage, osv.Model):
multi='day_close', type="float", store=True),
'color': fields.integer('Color Index'),
'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 = {
diff --git a/addons/lunch/report/order.rml b/addons/lunch/report/order.rml
index 30c16ad4894..b09b59bb96b 100644
--- a/addons/lunch/report/order.rml
+++ b/addons/lunch/report/order.rml
@@ -103,7 +103,7 @@
[[ user.name ]]
[[ user.login ]]
- [[ user.user_email ]]
+ [[ user.email ]]
|
diff --git a/addons/mail/data/mail_group_data.xml b/addons/mail/data/mail_group_data.xml
index 09a6ca29a2d..49c6fbdc1b6 100644
--- a/addons/mail/data/mail_group_data.xml
+++ b/addons/mail/data/mail_group_data.xml
@@ -21,7 +21,7 @@
Welcome to OpenERP!
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.
diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py
index b96b6e3791e..8845b3750b9 100644
--- a/addons/mail/mail_message.py
+++ b/addons/mail/mail_message.py
@@ -93,6 +93,9 @@ class mail_message_common(osv.TransientModel):
return result
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 = []
for message in self.browse(cr, uid, ids, context=context):
name = ''
@@ -208,12 +211,13 @@ class mail_message(osv.Model):
'partner_id': fields.many2one('res.partner', 'Related partner',
help="Deprecated field. Use partner_ids instead."),
'partner_ids': fields.many2many('res.partner',
- 'mail_message_destination_partner_rel',
+ 'mail_message_res_partner_rel',
'message_id', 'partner_id', 'Destination partners',
help="When sending emails through the social network composition wizard"\
"you may choose to send a copy of the mail to partners."),
'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),
'state': fields.selection([
('outgoing', 'Outgoing'),
@@ -371,7 +375,8 @@ class mail_message(osv.Model):
}
email_msg_id = self.create(cr, uid, msg_vals, context)
attachment_ids = []
- for fname, fcontent in attachments.iteritems():
+ for attachment in attachments:
+ fname, fcontent = attachment
attachment_data = {
'name': fname,
'datas_fname': fname,
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index f0dd023bf06..068dd844829 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -353,7 +353,7 @@ class mail_thread(osv.Model):
data.update({
'email_to': email_to,
'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_bcc': email_bcc,
'references': references,
@@ -771,7 +771,7 @@ class mail_thread(osv.Model):
for thread in self.browse(cr, uid, ids, context=context):
l = set()
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_cc or '')
res[thread.id] = filter(None, l)
@@ -985,9 +985,9 @@ class mail_thread(osv.Model):
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):
continue
- if not user.user_email:
+ if not user.email:
continue
- email_to = '%s, %s' % (email_to, user.user_email)
+ email_to = '%s, %s' % (email_to, user.email)
email_to = email_to.lstrip(', ')
# 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]
email_from = new_msg_values.get('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)
email_values = self.message_create_notify_get_email_dict(cr, uid, new_msg_values, email_from, email_to, context)
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index 8a590fc318f..c299df588d5 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -40,9 +40,8 @@ class res_users(osv.osv):
_columns = {
'notification_email_pref': fields.selection([
- ('all', 'All feeds'),
- ('comments', 'Only comments'),
- ('to_me', 'Only when sent directly to me'),
+ ('all', 'All Feeds'),
+ ('to_me', 'Only send directly to me'),
('none', 'Never')
], 'Receive Feeds by Email', required=True,
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)
# create a welcome message
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)
- self.message_append_note(cr, uid, [user_id], body=message, type='comment', context=context)
+ message = '''%s has joined %s! Welcome in OpenERP !
+
+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 Settings 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
def write(self, cr, uid, ids, vals, context=None):
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index d26511464f8..fe87b7584e0 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -100,7 +100,7 @@ class mail_compose_message(osv.TransientModel):
# Try to provide default email_from if not specified yet
if not result.get('email_from'):
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
_columns = {
@@ -133,7 +133,7 @@ class mail_compose_message(osv.TransientModel):
result.update({
'model': model,
'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_text': False,
'subject': False,
@@ -223,7 +223,7 @@ class mail_compose_message(osv.TransientModel):
'dest_partner_ids': dest_partner_ids,
'model': message_data.model 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_cc': message_data.email_cc or False,
'user_id': uid,
diff --git a/addons/portal_crm/wizard/contact.py b/addons/portal_crm/wizard/contact.py
index 505bb62bb16..036993e1720 100644
--- a/addons/portal_crm/wizard/contact.py
+++ b/addons/portal_crm/wizard/contact.py
@@ -50,7 +50,7 @@ class crm_contact_us(osv.TransientModel):
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if (user.login != 'anonymous'):
- return user.user_email
+ return user.email
else:
return None
diff --git a/addons/project/project.py b/addons/project/project.py
index 707df5607c6..355665152a2 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -794,7 +794,7 @@ class task(base_stage, osv.osv):
'company_id': fields.many2one('res.company', 'Company'),
'id': fields.integer('ID', readonly=True),
'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 = {
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 935935e28ca..33c2693d7bb 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -256,7 +256,7 @@ class project_issue(base_stage, osv.osv):
'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"),
'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_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.",
diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py
index 0ca2687b7f0..ba3cd702760 100644
--- a/addons/project_mailgate/project_mailgate.py
+++ b/addons/project_mailgate/project_mailgate.py
@@ -73,7 +73,7 @@ class project_tasks(osv.osv):
followers = super(project_tasks,self).message_thread_followers(cr, uid, ids, context=context)
for task in self.browse(cr, uid, followers.keys(), context=context):
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)
return followers
diff --git a/addons/purchase/edi/purchase_order_action_data.xml b/addons/purchase/edi/purchase_order_action_data.xml
index 70d402de598..b97da91fa1d 100644
--- a/addons/purchase/edi/purchase_order_action_data.xml
+++ b/addons/purchase/edi/purchase_order_action_data.xml
@@ -38,7 +38,7 @@
Automated Purchase Order Notification Mail
- ${object.validator.user_email or ''}
+ ${object.validator.email or ''}
${object.company_id.name} Order (Ref ${object.name or 'n/a' })
${object.partner_id.email}
@@ -61,7 +61,7 @@
% if object.partner_ref:
Your reference: ${object.partner_ref}
% endif
- Your contact: ${object.validator.name}
+ Your contact: ${object.validator.name}
@@ -121,7 +121,7 @@ Here is a ${object.state in ('draft', 'sent') and 'request for quotation' or 'pu
% if object.partner_ref:
| Your reference: ${object.partner_ref}
% 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:
${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}
% if object.company_id.street:
${object.company_id.street or ''}
diff --git a/addons/sale/edi/sale_order_action_data.xml b/addons/sale/edi/sale_order_action_data.xml
index 2fe0a8cbfd3..181bd8183d7 100644
--- a/addons/sale/edi/sale_order_action_data.xml
+++ b/addons/sale/edi/sale_order_action_data.xml
@@ -37,7 +37,7 @@
Automated Sale Order Notification Mail
- ${object.user_id.user_email or ''}
+ ${object.user_id.email or ''}
${object.company_id.name} Order (Ref ${object.name or 'n/a' })
${object.partner_invoice_id.email}
@@ -60,7 +60,7 @@
% if object.client_order_ref:
Your reference: ${object.client_order_ref}
% endif
- Your contact: ${object.user_id.name}
+ Your contact: ${object.user_id.name}
@@ -139,7 +139,7 @@ Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confi
% if object.client_order_ref:
| Your reference: ${object.client_order_ref}
% 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:
${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}
% if object.company_id.street:
${object.company_id.street or ''}
diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py
index b14da39633e..598bb085967 100644
--- a/addons/share/wizard/share_wizard.py
+++ b/addons/share/wizard/share_wizard.py
@@ -196,7 +196,7 @@ class share_wizard(osv.TransientModel):
}
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):
wizard_data = self.browse(cr,uid,ids,context)[0]
@@ -241,7 +241,7 @@ class share_wizard(osv.TransientModel):
if not wizard_data.invite:
existing = user_obj.search(cr, UID_ROOT, [('login', '=', new_user)])
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)
if existing:
new_line = { 'user_id': existing[0],
@@ -253,7 +253,7 @@ class share_wizard(osv.TransientModel):
'login': new_user,
'password': new_pass,
'name': new_user,
- 'user_email': new_user,
+ 'email': new_user,
'groups_id': [(6,0,[group_id])],
'share': True,
'message_email_pref': 'all',
@@ -825,12 +825,12 @@ class share_wizard(osv.TransientModel):
message_obj = self.pool.get('mail.message')
notification_obj = self.pool.get('mail.notification')
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.'))
# TODO: also send an HTML version of this mail
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:
continue
subject = _('Invitation to collaborate about %s') % (wizard_data.record_name)
@@ -849,20 +849,20 @@ class share_wizard(osv.TransientModel):
body += "--\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.")
- 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)
def send_emails(self, cr, uid, wizard_data, context=None):
_logger.info('Sending share notifications by email...')
mail_message = self.pool.get('mail.message')
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.'))
# TODO: also send an HTML version of this mail
msg_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:
continue
subject = wizard_data.name
@@ -883,7 +883,7 @@ class share_wizard(osv.TransientModel):
body += "--\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.")
- 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
mail_message.send(cr, uid, msg_ids, context=context)
_logger.info('%d share notification(s) sent.', len(msg_ids))
diff --git a/addons/survey/survey.py b/addons/survey/survey.py
index 0a96d1fde1c..93bd48be30c 100644
--- a/addons/survey/survey.py
+++ b/addons/survey/survey.py
@@ -740,7 +740,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.user_email}}
+ return {'value': {'email': user.email}}
return {}
survey_request()
diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py
index b3f27ed2970..66098b45fa8 100644
--- a/addons/survey/wizard/survey_answer.py
+++ b/addons/survey/wizard/survey_answer.py
@@ -414,8 +414,8 @@ class survey_question_wiz(osv.osv_memory):
file.close()
os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
- user_email = user_obj.browse(cr, uid, uid, context).user_email
- resp_email = survey_data.responsible_id and survey_data.responsible_id.user_email or False
+ user_email = user_obj.browse(cr, uid, uid, context).email
+ resp_email = survey_data.responsible_id and survey_data.responsible_id.email or False
if user_email and resp_email:
user_name = user_obj.browse(cr, uid, uid, context=context).name
From 1d0061351135b07bcb987ee6be1dc30700773dab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Fri, 10 Aug 2012 17:57:54 +0200
Subject: [PATCH 08/24] [IMP] mail.thread: res.users: messages appened to
res.users are attached to the related partner.
bzr revid: tde@openerp.com-20120810155754-c7towsarcawxe1le
---
addons/mail/res_users.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index c299df588d5..3d8ed92609b 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -123,6 +123,23 @@ To setup your preferences (name, email signature, avatar), click on the top righ
alias_pool.unlink(cr, uid, alias_ids, context=context)
return res
+ def message_append(self, cr, uid, threads, subject, body_text=None, body_html=None,
+ type='email', email_date=None, parent_id=False,
+ content_subtype='plain', state=None,
+ partner_ids=None, email_from=False, email_to=False,
+ email_cc=None, email_bcc=None, reply_to=None,
+ headers=None, message_id=False, references=None,
+ attachments=None, original=None, context=None):
+ """ Override of message_append. Messages appened to res.users are
+ redirected to the related partner. Using partner_id.message_append,
+ messages will have correct model and id, set to res_partner and
+ partner_id.id.
+ """
+ for user in self.browse(cr, uid, threads, context=context):
+ user.partner_id.message_append(subject, body_text, body_html, type, email_date, parent_id,
+ content_subtype, state, partner_ids, email_from, email_to, email_cc, email_bcc, reply_to,
+ headers, message_id, references, attachments, original)
+
def message_search_get_domain(self, cr, uid, ids, context=None):
""" Override of message_search_get_domain for partner discussion page.
The purpose is to add messages directly sent to user using
From db7e49ca91d483213c8ba61d4314411c899e0f23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Mon, 13 Aug 2012 10:10:54 +0200
Subject: [PATCH 09/24] [FIX] project_timesheet tests: user creation should
also have its partner.
bzr revid: tde@openerp.com-20120813081054-csyaq8p7lf7e1nvh
---
addons/mail/res_users.py | 1 -
.../test/worktask_entry_to_timesheetline_entry.yml | 6 ++++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index 3d8ed92609b..6a18560de31 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -85,7 +85,6 @@ class res_users(osv.osv):
cr.execute('ALTER TABLE res_users ALTER COLUMN alias_id SET NOT NULL')
except Exception:
pass
-
def create(self, cr, uid, data, context=None):
# create default alias same as the login
diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
index 214aa04d25b..8b58791f699 100644
--- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
+++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
@@ -1,11 +1,13 @@
-
Create a user 'HR Manager'
-
+ !record {model: res.partner, id: res_partner_hrmanager0}:
+ name: HR Manager
+ lang: en_US
!record {model: res.users, id: res_users_hrmanager0}:
company_id: base.main_company
- lang: en_US
+ partner_id: res_partner_hrmanager0
login: hr
- name: HR Manager
password: hr
groups_id:
- base.group_hr_manager
From e120d9a699247c6fbdfbf21648a71e321642b2bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Mon, 13 Aug 2012 11:17:19 +0200
Subject: [PATCH 10/24] [REV] Reverted last fixes. Think it comes from outer
space.
bzr revid: tde@openerp.com-20120813091719-6551uziq8ts4kj6a
---
.../test/worktask_entry_to_timesheetline_entry.yml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
index 8b58791f699..8bb570bd7d8 100644
--- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
+++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
@@ -1,9 +1,6 @@
-
Create a user 'HR Manager'
-
- !record {model: res.partner, id: res_partner_hrmanager0}:
- name: HR Manager
- lang: en_US
!record {model: res.users, id: res_users_hrmanager0}:
company_id: base.main_company
partner_id: res_partner_hrmanager0
From f80c2478120e4fcf4e80f5c2932328dce88218b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Mon, 13 Aug 2012 12:54:20 +0200
Subject: [PATCH 11/24] [FIX] Still fixing stpid bugs.
bzr revid: tde@openerp.com-20120813105420-stxm7cjc981bj8fq
---
.../test/worktask_entry_to_timesheetline_entry.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
index 8bb570bd7d8..fad8e2af2c5 100644
--- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
+++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
@@ -3,7 +3,6 @@
-
!record {model: res.users, id: res_users_hrmanager0}:
company_id: base.main_company
- partner_id: res_partner_hrmanager0
login: hr
password: hr
groups_id:
From c2c27b18582db97b0d17f9c32291f28c76cf8edb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Mon, 13 Aug 2012 13:15:21 +0200
Subject: [PATCH 12/24] [FIX$] This time, it's the good fix.
bzr revid: tde@openerp.com-20120813111521-uws1uophrd39krfg
---
.../test/worktask_entry_to_timesheetline_entry.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
index fad8e2af2c5..e670f5bae06 100644
--- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
+++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
@@ -3,6 +3,7 @@
-
!record {model: res.users, id: res_users_hrmanager0}:
company_id: base.main_company
+ name: HR Manager
login: hr
password: hr
groups_id:
From 988e04188aadab688458eb62415f0eb9433bd3a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 11:32:02 +0200
Subject: [PATCH 13/24] [RM] Portal: removed res_users override, because
partner_id is now in base. Removed view and update init and openerp files
accordingly.
bzr revid: tde@openerp.com-20120814093202-7do78o1h9z44aj53
---
addons/portal/__init__.py | 1 -
addons/portal/__openerp__.py | 1 -
addons/portal/res_user.py | 34 ---------------------------------
addons/portal/res_user_view.xml | 19 ------------------
4 files changed, 55 deletions(-)
delete mode 100644 addons/portal/res_user.py
delete mode 100644 addons/portal/res_user_view.xml
diff --git a/addons/portal/__init__.py b/addons/portal/__init__.py
index 65b924183e1..9c6cc59be7d 100644
--- a/addons/portal/__init__.py
+++ b/addons/portal/__init__.py
@@ -21,7 +21,6 @@
import portal
import wizard
-import res_user
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/portal/__openerp__.py b/addons/portal/__openerp__.py
index 97183bccd9f..6669efbcf77 100644
--- a/addons/portal/__openerp__.py
+++ b/addons/portal/__openerp__.py
@@ -43,7 +43,6 @@ very handy when used in combination with the module 'share'.
'security/ir.model.access.csv',
'portal_view.xml',
'portal_data.xml',
- 'res_user_view.xml',
'wizard/portal_wizard_view.xml',
'wizard/share_wizard_view.xml',
],
diff --git a/addons/portal/res_user.py b/addons/portal/res_user.py
deleted file mode 100644
index 9ed95a8a740..00000000000
--- a/addons/portal/res_user.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2011 OpenERP S.A ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import osv, fields
-
-
-
-class res_users(osv.osv):
- _inherit = 'res.users'
- _columns = {
- 'partner_id': fields.many2one('res.partner',
- string='Related Partner'),
- }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/portal/res_user_view.xml b/addons/portal/res_user_view.xml
deleted file mode 100644
index d481b865b79..00000000000
--- a/addons/portal/res_user_view.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
- res.portal.users.form
- res.users
- form
-
-
-
-
-
-
-
-
-
-
From 15d997d37b13f4efdf97dd340ee6ab35521ddac4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 12:15:35 +0200
Subject: [PATCH 14/24] [RM] [CLEAN] auth_signup: removed unique constraint on
email, because what is important is the login; added licence header in files.
bzr revid: tde@openerp.com-20120814101535-3fxb1w88qh33srbi
---
addons/auth_signup/__init__.py | 21 +++++++++++
addons/auth_signup/__openerp__.py | 61 +++++++++++++++++++++----------
addons/auth_signup/auth_signup.py | 28 ++++++++++----
addons/auth_signup/res_config.py | 21 +++++++++++
4 files changed, 104 insertions(+), 27 deletions(-)
diff --git a/addons/auth_signup/__init__.py b/addons/auth_signup/__init__.py
index 2e404949550..1a120e52d18 100644
--- a/addons/auth_signup/__init__.py
+++ b/addons/auth_signup/__init__.py
@@ -1,2 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2012-today OpenERP SA ()
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see
+#
+##############################################################################
+
import res_config
import auth_signup
diff --git a/addons/auth_signup/__openerp__.py b/addons/auth_signup/__openerp__.py
index a869c623db0..227d5f1017d 100644
--- a/addons/auth_signup/__openerp__.py
+++ b/addons/auth_signup/__openerp__.py
@@ -1,22 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2009-today OpenERP SA ()
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see
+#
+##############################################################################
+
{
- 'name': 'Signup',
- 'description': 'Allow users to sign up',
- 'author': 'OpenERP SA',
- 'version': '1.0',
- 'category': 'Authentication',
- 'website': 'http://www.openerp.com',
- 'installable': True,
- 'depends': ['auth_anonymous', 'base_setup'],
- 'data': [
- 'res_config.xml',
- ],
- 'js': [
- 'static/src/js/auth_signup.js',
- ],
- 'css': [
- 'static/src/css/auth_signup.css',
- ],
- 'qweb': [
- 'static/src/xml/auth_signup.xml',
- ],
+ 'name': 'Signup',
+ 'description': 'Allow users to sign up',
+ 'author': 'OpenERP SA',
+ 'version': '1.0',
+ 'category': 'Authentication',
+ 'website': 'http://www.openerp.com',
+ 'installable': True,
+ 'depends': ['auth_anonymous', 'base_setup'],
+ 'data': [
+ 'res_config.xml',
+ ],
+ 'js': [
+ 'static/src/js/auth_signup.js',
+ ],
+ 'css': [
+ 'static/src/css/auth_signup.css',
+ ],
+ 'qweb': [
+ 'static/src/xml/auth_signup.xml',
+ ],
}
diff --git a/addons/auth_signup/auth_signup.py b/addons/auth_signup/auth_signup.py
index fedce607206..96d1ea132de 100644
--- a/addons/auth_signup/auth_signup.py
+++ b/addons/auth_signup/auth_signup.py
@@ -1,12 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2012-today OpenERP SA ()
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see
+#
+##############################################################################
+
from openerp.osv import osv, fields
-class res_users(osv.Model):
- _inherit = 'res.users'
-
- _sql_constraints = [
- ('email_uniq', 'UNIQUE (email)', 'You can not have two users with the same email!')
- ]
-
class signup_signup(osv.TransientModel):
_name = 'auth.signup'
diff --git a/addons/auth_signup/res_config.py b/addons/auth_signup/res_config.py
index 2828a2b55fd..a9a490de8c5 100644
--- a/addons/auth_signup/res_config.py
+++ b/addons/auth_signup/res_config.py
@@ -1,3 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2012-today OpenERP SA ()
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see
+#
+##############################################################################
+
from openerp.osv import osv, fields
class base_config_settings(osv.TransientModel):
From a381c0adce6ff6a6db3ca34d24cd13a65f5d1a39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 17:20:53 +0200
Subject: [PATCH 15/24] [REVIEW] res_users in mail_thread: no
Chatter-compatible anymore ! Some cleaning will follow. Also reidented some
code.
bzr revid: tde@openerp.com-20120814152053-edu3i87uzd8ev0u0
---
addons/mail/res_users.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index 6a18560de31..30337c84fe4 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -35,7 +35,7 @@ class res_users(osv.osv):
- add a welcome message
"""
_name = 'res.users'
- _inherit = ['res.users', 'mail.thread']
+ _inherit = ['res.users']
_inherits = {'mail.alias': 'alias_id'}
_columns = {
@@ -45,10 +45,10 @@ class res_users(osv.osv):
('none', 'Never')
], 'Receive Feeds by Email', required=True,
help="Choose in which case you want to receive an email when you "\
- "receive new feeds."),
+ "receive new feeds."),
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,
- help="Email address internally associated with this user. Incoming emails will appear "
- "in the user's notifications."),
+ help="Email address internally associated with this user. Incoming "\
+ "emails will appear in the user's notifications."),
}
_defaults = {
From 40e2dbbab2aec306f55838e7acd9ca77022722bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 18:48:17 +0200
Subject: [PATCH 16/24] [IMP] mail_thread: res_users do not inherit from
mail.thread anymore. Moved the search_domain of chatter of res.users (@login)
to the partner, that have to find its related partner.
bzr revid: tde@openerp.com-20120814164817-8mw4txrmvka484wg
---
addons/mail/res_partner.py | 16 +++++++++++++---
addons/mail/res_users.py | 20 ++------------------
2 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/addons/mail/res_partner.py b/addons/mail/res_partner.py
index 3dc1f91d857..e162ccd81cc 100644
--- a/addons/mail/res_partner.py
+++ b/addons/mail/res_partner.py
@@ -29,11 +29,21 @@ class res_partner_mail(osv.osv):
def message_search_get_domain(self, cr, uid, ids, context=None):
""" Override of message_search_get_domain for partner discussion page.
- The purpose is to add messages directly sent to the partner.
+ The purpose is to add messages directly sent to the partner. It also
+ adds messages pushed to the related user, if any, using @login.
"""
initial_domain = super(res_partner_mail, self).message_search_get_domain(cr, uid, ids, context=context)
- if self._name == 'res.partner': # to avoid models inheriting from res.partner
- search_domain = ['|'] + initial_domain + ['|', ('partner_id', 'in', ids), ('partner_ids', 'in', ids)]
+ # to avoid models inheriting from res.partner
+ if self._name != 'res.partner':
+ return initial_domain
+ # add message linked to the partner
+ search_domain = ['|'] + initial_domain + ['|', ('partner_id', 'in', ids), ('partner_ids', 'in', ids)]
+ # if partner is linked to a user: find @login
+ res_users_obj = self.pool.get('res.users')
+ user_ids = res_users_obj.search(cr, uid, [('partner_id', 'in', ids)], context=context)
+ for user in res_user_obj.browse(cr, uid, user_ids, context=context):
+ search_domain = ['|'] + search_domain + ['|', ('body_text', 'like', '@%s' % (user.login)), ('body_html', 'like', '@%s' % (user.login))]
+ print search_domain
return search_domain
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index 184eb2b502e..391ddb60036 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -143,28 +143,12 @@ To setup your preferences (name, email signature, avatar), click on the top righ
email_cc=None, email_bcc=None, reply_to=None,
headers=None, message_id=False, references=None,
attachments=None, original=None, context=None):
- """ Override of message_append. Messages appened to res.users are
- redirected to the related partner. Using partner_id.message_append,
- messages will have correct model and id, set to res_partner and
- partner_id.id.
- """
+ """ Wrapper on message_append to redirect them to the related partner. """
for user in self.browse(cr, uid, threads, context=context):
user.partner_id.message_append(subject, body_text, body_html, type, email_date, parent_id,
content_subtype, state, partner_ids, email_from, email_to, email_cc, email_bcc, reply_to,
headers, message_id, references, attachments, original)
- def message_search_get_domain(self, cr, uid, ids, context=None):
- """ Override of message_search_get_domain for partner discussion page.
- The purpose is to add messages directly sent to user using
- @user_login.
- """
- initial_domain = super(res_users, self).message_search_get_domain(cr, uid, ids, context=context)
- custom_domain = []
- for user in self.browse(cr, uid, ids, context=context):
- if custom_domain:
- custom_domain += ['|']
- custom_domain += ['|', ('body_text', 'like', '@%s' % (user.login)), ('body_html', 'like', '@%s' % (user.login))]
- return ['|'] + initial_domain + custom_domain
class res_users_mail_group(osv.osv):
""" Update of res.groups class
@@ -173,7 +157,7 @@ class res_users_mail_group(osv.osv):
group. This is done by overriding the write method.
"""
_name = 'res.users'
- _inherit = ['res.users', 'mail.thread']
+ _inherit = ['res.users']
def write(self, cr, uid, ids, vals, context=None):
write_res = super(res_users_mail_group, self).write(cr, uid, ids, vals, context=context)
From 5249a3fadf861c051a2cac3323e1d7536ba00ef7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 19:03:42 +0200
Subject: [PATCH 17/24] [FIX] mail_thread: import res_partner before res_users.
bzr revid: tde@openerp.com-20120814170342-y10dzgromrpppa6i
---
addons/mail/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/mail/__init__.py b/addons/mail/__init__.py
index b19aad1afe3..d7a3d1a6fdb 100644
--- a/addons/mail/__init__.py
+++ b/addons/mail/__init__.py
@@ -25,8 +25,8 @@ import mail_thread
import mail_group
import mail_subscription
import ir_needaction
-import res_users
import res_partner
+import res_users
import report
import wizard
import res_config
From 4a9be8de85e00f0319bb2f3381643502c6b1d214 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 20:49:31 +0200
Subject: [PATCH 18/24] [REVIEW] res_users in mail_thread: removed form view
inheritance adding Chatter.
bzr revid: tde@openerp.com-20120814184931-q2hnox9dhc87wc27
---
addons/mail/res_users_view.xml | 5 -----
1 file changed, 5 deletions(-)
diff --git a/addons/mail/res_users_view.xml b/addons/mail/res_users_view.xml
index 527bf041948..005d71cb09f 100644
--- a/addons/mail/res_users_view.xml
+++ b/addons/mail/res_users_view.xml
@@ -26,11 +26,6 @@
-
-
-
-
-
From 9deb60afe22227030653abb352e791ed4f94d9bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 20:49:56 +0200
Subject: [PATCH 19/24] [FIX] Fixed typo in var name.
bzr revid: tde@openerp.com-20120814184956-qk4isl8rljf4nxzk
---
addons/mail/res_partner.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/addons/mail/res_partner.py b/addons/mail/res_partner.py
index e162ccd81cc..d3a61b31a8a 100644
--- a/addons/mail/res_partner.py
+++ b/addons/mail/res_partner.py
@@ -20,9 +20,8 @@
##############################################################################
from osv import osv
-from osv import fields
-class res_partner_mail(osv.osv):
+class res_partner_mail(osv.Model):
""" Inherits partner and adds CRM information in the partner form """
_name = "res.partner"
_inherit = ['res.partner', 'mail.thread']
@@ -41,9 +40,8 @@ class res_partner_mail(osv.osv):
# if partner is linked to a user: find @login
res_users_obj = self.pool.get('res.users')
user_ids = res_users_obj.search(cr, uid, [('partner_id', 'in', ids)], context=context)
- for user in res_user_obj.browse(cr, uid, user_ids, context=context):
+ for user in res_users_obj.browse(cr, uid, user_ids, context=context):
search_domain = ['|'] + search_domain + ['|', ('body_text', 'like', '@%s' % (user.login)), ('body_html', 'like', '@%s' % (user.login))]
- print search_domain
return search_domain
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
From a05b3f3a2ec29fbb3c1d5f6b7f64004290b6c62d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 20:50:25 +0200
Subject: [PATCH 20/24] [REVIEW] res_users: added wrappers on some Chatter
methods; moved welcome message on the partner.
bzr revid: tde@openerp.com-20120814185025-g5kdwisy2rjnipsb
---
addons/mail/res_users.py | 50 ++++++++++++++++++++++++++++------------
1 file changed, 35 insertions(+), 15 deletions(-)
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index 391ddb60036..ca9766e481c 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -28,7 +28,7 @@ from tools.translate import _
_logger = logging.getLogger(__name__)
-class res_users(osv.osv):
+class res_users(osv.Model):
""" Update of res.users class
- add a preference about sending emails about notifications
- make a new user follow itself
@@ -37,7 +37,7 @@ class res_users(osv.osv):
_name = 'res.users'
_inherit = ['res.users']
_inherits = {'mail.alias': 'alias_id'}
-
+
_columns = {
'notification_email_pref': fields.selection([
('all', 'All Feeds'),
@@ -69,13 +69,13 @@ class res_users(osv.osv):
def _auto_init(self, cr, context=None):
"""Installation hook to create aliases for all users and avoid constraint errors."""
-
+
# disable the unique alias_id not null constraint, to avoid spurious warning during
# super.auto_init. We'll reinstall it afterwards.
self._columns['alias_id'].required = False
super(res_users,self)._auto_init(cr, context=context)
-
+
registry = RegistryManager.get(cr.dbname)
mail_alias = registry.get('mail.alias')
res_users_model = registry.get('res.users')
@@ -105,13 +105,22 @@ class res_users(osv.osv):
alias_id = mail_alias.create_unique_alias(cr, uid, {'alias_name': data['login']}, model_name=self._name, context=context)
data['alias_id'] = alias_id
data.pop('alias_name', None) # prevent errors during copy()
+ # create user that follows its related partner
user_id = super(res_users, self).create(cr, uid, data, context=context)
- mail_alias.write(cr, SUPERUSER_ID, [alias_id], {"alias_force_thread_id": user_id}, context)
-
user = self.browse(cr, uid, user_id, context=context)
- # make user follow itself
- self.message_subscribe(cr, uid, [user_id], [user_id], context=context)
+ self.pool.get('res.partner').message_subscribe(cr, uid, [user.partner_id.id], [user_id], context=context)
+ # alias
+ mail_alias.write(cr, SUPERUSER_ID, [alias_id], {"alias_force_thread_id": user_id}, context)
# create a welcome message
+ self.create_welcome_message_and_email(cr, uid, user, context=context)
+ return user_id
+
+ def create_welcome_message_and_email(self, cr, uid, user, context=None):
+ """ Method to :
+ - create a welcome message on the partner wall
+ - send an email to the user with the instance URL / login (#TODO)
+ :param user: res_users browse_record
+ """
company_name = user.company_id.name if user.company_id else _('the company')
message = '''%s has joined %s! Welcome in OpenERP !
@@ -120,9 +129,9 @@ Your homepage is a summary of messages you received and key information about do
The top menu bar contains all applications you installed. You can use this Settings 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 self.pool.get('res.partner').message_append_note(cr, uid, [user.partner_id.id],
+ subject='Welcome to OpenERP', body=message, type='comment', content_subtype='html', context=context)
+
def write(self, cr, uid, ids, vals, context=None):
# User alias is sync'ed with login
if vals.get('login'): vals['alias_name'] = vals['login']
@@ -135,7 +144,11 @@ To setup your preferences (name, email signature, avatar), click on the top righ
res = super(res_users, self).unlink(cr, uid, ids, context=context)
alias_pool.unlink(cr, uid, alias_ids, context=context)
return res
-
+
+ # --------------------------------------------------
+ # Wrappers on partner methods for Chatter
+ # --------------------------------------------------
+
def message_append(self, cr, uid, threads, subject, body_text=None, body_html=None,
type='email', email_date=None, parent_id=False,
content_subtype='plain', state=None,
@@ -143,14 +156,21 @@ To setup your preferences (name, email signature, avatar), click on the top righ
email_cc=None, email_bcc=None, reply_to=None,
headers=None, message_id=False, references=None,
attachments=None, original=None, context=None):
- """ Wrapper on message_append to redirect them to the related partner. """
for user in self.browse(cr, uid, threads, context=context):
user.partner_id.message_append(subject, body_text, body_html, type, email_date, parent_id,
content_subtype, state, partner_ids, email_from, email_to, email_cc, email_bcc, reply_to,
headers, message_id, references, attachments, original)
+ def message_read(self, cr, uid, ids, fetch_ancestors=False, ancestor_ids=None,
+ limit=100, offset=0, domain=None, context=None):
+ for user in self.browse(cr, uid, ids, context=context):
+ user.partner_id.message_read(ids, fetch_ancestors, ancestor_ids, limit, offset, domain)
-class res_users_mail_group(osv.osv):
+ def message_read_subscribers(self, cr, uid, ids, fields=['id', 'name', 'image_small'], context=None):
+ for user in self.browse(cr, uid, ids, context=context):
+ user.partner_id.message_read_subscribers(ids, fields)
+
+class res_users_mail_group(osv.Model):
""" Update of res.groups class
- if adding/removing users from a group, check mail.groups linked to
this user group, and subscribe / unsubscribe them from the discussion
@@ -171,7 +191,7 @@ class res_users_mail_group(osv.osv):
return write_res
-class res_groups_mail_group(osv.osv):
+class res_groups_mail_group(osv.Model):
""" Update of res.groups class
- if adding/removing users from a group, check mail.groups linked to
this user group, and subscribe / unsubscribe them from the discussion
From 9532bbb033b4b3a4285e5cc2341ef47413aac255 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 21:16:03 +0200
Subject: [PATCH 21/24] [FIX] procurement_order: moved a chatter message from
user to the procurement.order; deleted second message_append_note that was
never called, because of a void variable.
bzr revid: tde@openerp.com-20120814191603-u1lsovhurrvuxbm4
---
addons/procurement/schedulers.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/addons/procurement/schedulers.py b/addons/procurement/schedulers.py
index 1ad1046efce..7a87697f5c8 100644
--- a/addons/procurement/schedulers.py
+++ b/addons/procurement/schedulers.py
@@ -131,7 +131,7 @@ class procurement_order(osv.osv):
Exceptions:\n""") % (start_date, end_date, report_total, report_except, report_later)
summary += '\n'.join(report)
- self.pool.get('res.users').message_append_note(cr, uid, [uid], body=summary, context=context)
+ procurement_obj.message_append_note(cr, uid, ids, body=summary, context=context)
if use_new_cursor:
cr.commit()
@@ -234,7 +234,6 @@ class procurement_order(osv.osv):
location_obj = self.pool.get('stock.location')
procurement_obj = self.pool.get('procurement.order')
wf_service = netsvc.LocalService("workflow")
- report = []
offset = 0
ids = [1]
if automatic:
@@ -288,9 +287,6 @@ class procurement_order(osv.osv):
offset += len(ids)
if use_new_cursor:
cr.commit()
- if user_id and report:
- # Chatter: old res.request is now a chatter on res.users, id=uid
- self.pool.get('res.users').message_append_note(cr, uid, [user_id], body='\n'.join(report), subject=_('Orderpoint report'), context=context)
if use_new_cursor:
cr.commit()
cr.close()
From 87f657f9efbd013b840b51d19efb66cc8c06eb8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Tue, 14 Aug 2012 21:43:22 +0200
Subject: [PATCH 22/24] [REM] mail.js: removed debugger added by FP... you
could have check before merging for this one -_- .
bzr revid: tde@openerp.com-20120814194322-yj7nyekugt7rmzn8
---
addons/mail/static/src/js/mail.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index c068074b457..ba8df2d1671 100644
--- a/addons/mail/static/src/js/mail.js
+++ b/addons/mail/static/src/js/mail.js
@@ -1021,7 +1021,6 @@ openerp.mail = function(session) {
if (this.compose_message_widget) {
this.compose_message_widget.destroy();
}
- debugger;
this.compose_message_widget = new mail.ComposeMessage(this, {
'extended_mode': false, 'uid': this.session.uid, 'res_model': this.params.res_model,
'res_id': this.params.res_id, 'mode': mode || 'comment', 'msg_id': msg_id });
From dab2e03c6281dbcb018800f0f095f60f5932db00 Mon Sep 17 00:00:00 2001
From: Antony Lesuisse
Date: Wed, 15 Aug 2012 14:50:53 +0200
Subject: [PATCH 23/24] [FIX] res.users creation message
bzr revid: al@openerp.com-20120815125053-3hq8w0gjrnm63342
---
addons/mail/res_users.py | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index ca9766e481c..53ae05371cf 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -112,25 +112,15 @@ class res_users(osv.Model):
# alias
mail_alias.write(cr, SUPERUSER_ID, [alias_id], {"alias_force_thread_id": user_id}, context)
# create a welcome message
- self.create_welcome_message_and_email(cr, uid, user, context=context)
+ self.create_welcome_message(cr, uid, user, context=context)
return user_id
- def create_welcome_message_and_email(self, cr, uid, user, context=None):
- """ Method to :
- - create a welcome message on the partner wall
- - send an email to the user with the instance URL / login (#TODO)
- :param user: res_users browse_record
- """
+ def create_welcome_message(self, cr, uid, user, context=None):
company_name = user.company_id.name if user.company_id else _('the company')
- message = '''%s has joined %s! Welcome in OpenERP !
-
-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 Settings 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)
- return self.pool.get('res.partner').message_append_note(cr, uid, [user.partner_id.id],
- subject='Welcome to OpenERP', body=message, type='comment', content_subtype='html', context=context)
+ subject = '''%s has joined %s.''' % (user.name, company_name)
+ body = '''Welcome to OpenERP !'''
+ return self.pool.get('res.partner').message_append_note(cr, user.id, [user.partner_id.id],
+ subject=subject, body=body, type='comment', content_subtype='html', context=context)
def write(self, cr, uid, ids, vals, context=None):
# User alias is sync'ed with login
@@ -189,7 +179,6 @@ class res_users_mail_group(osv.Model):
mail_group_ids = mail_group_obj.search(cr, uid, [('group_ids', 'in', user_group_ids)], context=context)
mail_group_obj.message_subscribe(cr, uid, mail_group_ids, ids, context=context)
return write_res
-
class res_groups_mail_group(osv.Model):
""" Update of res.groups class
@@ -209,3 +198,5 @@ class res_groups_mail_group(osv.Model):
mail_group_ids = mail_group_obj.search(cr, uid, [('group_ids', 'in', ids)], context=context)
mail_group_obj.message_subscribe(cr, uid, mail_group_ids, user_ids, context=context)
return super(res_groups_mail_group, self).write(cr, uid, ids, vals, context=context)
+
+# vim:et:
From 16719d3f5bfdfa993528a289f9ee06047944630e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?=
Date: Wed, 15 Aug 2012 20:45:38 +0200
Subject: [PATCH 24/24] [FIX] res_users in mail_thread: added missing wrappers
for Chatter.
bzr revid: tde@openerp.com-20120815184538-dno2w20on4fd2hqd
---
addons/mail/res_users.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py
index 53ae05371cf..647be2bde6d 100644
--- a/addons/mail/res_users.py
+++ b/addons/mail/res_users.py
@@ -137,6 +137,8 @@ class res_users(osv.Model):
# --------------------------------------------------
# Wrappers on partner methods for Chatter
+ # #FIXME: another branch holds a refactoring of mail.thread
+ # that should help cleaning those wrappers
# --------------------------------------------------
def message_append(self, cr, uid, threads, subject, body_text=None, body_html=None,
@@ -154,11 +156,25 @@ class res_users(osv.Model):
def message_read(self, cr, uid, ids, fetch_ancestors=False, ancestor_ids=None,
limit=100, offset=0, domain=None, context=None):
for user in self.browse(cr, uid, ids, context=context):
- user.partner_id.message_read(ids, fetch_ancestors, ancestor_ids, limit, offset, domain)
+ return user.partner_id.message_read(fetch_ancestors, ancestor_ids, limit, offset, domain)
def message_read_subscribers(self, cr, uid, ids, fields=['id', 'name', 'image_small'], context=None):
for user in self.browse(cr, uid, ids, context=context):
- user.partner_id.message_read_subscribers(ids, fields)
+ return user.partner_id.message_read_subscribers(fields)
+
+ def message_search(self, cr, uid, ids, fetch_ancestors=False, ancestor_ids=None,
+ limit=100, offset=0, domain=None, count=False, context=None):
+ for user in self.browse(cr, uid, ids, context=context):
+ return user.partner_id.message_search(fetch_ancestors, ancestor_ids, limit, offset, domain, count)
+
+ def message_subscribe(self, cr, uid, ids, user_ids = None, context=None):
+ for user in self.browse(cr, uid, ids, context=context):
+ return user.partner_id.message_subscribe(user_ids)
+
+ def message_unsubscribe(self, cr, uid, ids, user_ids = None, context=None):
+ for user in self.browse(cr, uid, ids, context=context):
+ return user.partner_id.message_unsubscribe(user_ids)
+
class res_users_mail_group(osv.Model):
""" Update of res.groups class