[REF] addons: propagated change about context_lang and context_tz.

bzr revid: tde@openerp.com-20120810102257-g9r21nesh799kf7u
This commit is contained in:
Thibault Delavallée 2012-08-10 12:22:57 +02:00
parent 8afd274c2d
commit 8e6cc3a924
5 changed files with 19 additions and 19 deletions

View File

@ -245,7 +245,7 @@ class calendar_attendee(osv.osv):
continue
else:
result[id][name] = self._get_address(attdata.sent_by_uid.name, \
attdata.sent_by_uid.user_email)
attdata.sent_by_uid.email)
if name == 'cn':
if attdata.user_id:
@ -289,7 +289,7 @@ class calendar_attendee(osv.osv):
if name == 'language':
user_obj = self.pool.get('res.users')
lang = user_obj.read(cr, uid, uid, ['context_lang'], context=context)['context_lang']
lang = user_obj.read(cr, uid, uid, ['lang'], context=context)['lang']
result[id][name] = lang.replace('_', '-')
return result
@ -434,7 +434,7 @@ property or property parameter."),
if not organizer:
organizer = event_obj.user_id
event_org.params['CN'] = [organizer.name]
event_org.value = 'MAILTO:' + (organizer.user_email or organizer.name)
event_org.value = 'MAILTO:' + (organizer.email or organizer.name)
if event_obj.alarm_id:
# computes alarm data
@ -535,7 +535,7 @@ property or property parameter."),
return {'value': {'email': ''}}
usr_obj = self.pool.get('res.users')
user = usr_obj.browse(cr, uid, user_id, *args)
return {'value': {'email': user.user_email, 'availability':user.availability}}
return {'value': {'email': user.email, 'availability':user.availability}}
def do_tentative(self, cr, uid, ids, context=None, *args):
""" Makes event invitation as Tentative
@ -891,9 +891,9 @@ From:
""" % (alarm.name, alarm.trigger_date, alarm.description, \
alarm.user_id.name, alarm.user_id.signature)
mail_to = [alarm.user_id.user_email]
mail_to = [alarm.user_id.email]
for att in alarm.attendee_ids:
mail_to.append(att.user_id.user_email)
mail_to.append(att.user_id.email)
if mail_to:
mail_message.schedule_with_attach(cr, uid,
tools.config.get('email_from', False),
@ -947,7 +947,7 @@ class calendar_event(osv.osv):
value['duration'] = duration
# change start_date's time to 00:00:00 in the user's timezone
user = self.pool.get('res.users').browse(cr, uid, uid)
tz = pytz.timezone(user.context_tz) if user.context_tz else pytz.utc
tz = pytz.timezone(user.tz) if user.tz else pytz.utc
start = pytz.utc.localize(start).astimezone(tz) # convert start in user's timezone
start = start.replace(hour=0, minute=0, second=0) # change start's time to 00:00:00
start = start.astimezone(pytz.utc) # convert start back to utc
@ -1097,8 +1097,8 @@ rule or repeating pattern of time to exclude from the recurring rule."),
user_pool = self.pool.get('res.users')
user = user_pool.browse(cr, uid, uid, context=context)
res = user.name
if user.user_email:
res += " <%s>" %(user.user_email)
if user.email:
res += " <%s>" %(user.email)
return res
_defaults = {

View File

@ -99,12 +99,12 @@ send an Email to Invited Person')
user = user_obj.browse(cr, uid, user_id)
res = {
'user_id': user_id,
'email': user.user_email
'email': user.email
}
res.update(ref)
vals.append(res)
if user.user_email:
mail_to.append(user.user_email)
if user.email:
mail_to.append(user.email)
elif type == 'external' and datas.get('email'):
res = {'email': datas['email']}
@ -143,7 +143,7 @@ send an Email to Invited Person')
self._columns['type'].selection))
raise osv.except_osv(_('Error!'), _("%s must have an email address to send mail.") %(name[0]))
att_obj._send_mail(cr, uid, attendees, mail_to, \
email_from = current_user.user_email or tools.config.get('email_from', False))
email_from = current_user.email or tools.config.get('email_from', False))
return {'type': 'ir.actions.act_window_close'}

View File

@ -50,7 +50,7 @@ class specify_partner_terminology(osv.osv_memory):
def make_translations(self, cr, uid, ids, name, type, src, value, res_id=0, context=None):
trans_obj = self.pool.get('ir.translation')
user_obj = self.pool.get('res.users')
context_lang = user_obj.browse(cr, uid, uid, context=context).context_lang
context_lang = user_obj.browse(cr, uid, uid, context=context).lang
existing_trans_ids = trans_obj.search(cr, uid, [('name','=',name), ('lang','=',context_lang), ('type','=',type), ('src','=',src), ('res_id','=',res_id)])
if existing_trans_ids:
trans_obj.write(cr, uid, existing_trans_ids, {'value': value}, context=context)

View File

@ -877,7 +877,7 @@ class sugar_import(import_framework):
else:
val['password'] = 'sugarcrm' #default password for all user #TODO needed in documentation
val['context_lang'] = self.context.get('lang','en_US')
val['lang'] = self.context.get('lang','en_US')
return val
def get_users_department(self, val):
@ -895,10 +895,10 @@ class sugar_import(import_framework):
'map' : {
'name': concat('first_name', 'last_name'),
'login': value('user_name', fallback='last_name'),
'context_lang' : 'context_lang',
'lang' : 'context_lang',
'password' : 'password',
'.id' : '.id',
'user_email' : 'email1',
'email' : 'email1',
}
}
@ -964,7 +964,7 @@ class import_sugarcrm(osv.osv):
}
def _get_email_id(self, cr, uid, context=None):
return self.pool.get('res.users').browse(cr, uid, uid, context=context).user_email
return self.pool.get('res.users').browse(cr, uid, uid, context=context).email
def _module_installed(self, cr, uid, model, context=None):
module_id = self.pool.get('ir.module.module').search(cr, uid, [('name', '=', model), ('state', "=", "installed")], context=context)

View File

@ -3,7 +3,7 @@
-
!record {model: res.users, id: res_users_hrmanager0}:
company_id: base.main_company
context_lang: en_US
lang: en_US
login: hr
name: HR Manager
password: hr