[FIX] res_partner.py: read countries as SUPERUSER

res_users.py: add login to the readable fields

bzr revid: abo@openerp.com-20120918141421-k6awa3xf6x2nx691
This commit is contained in:
Antonin Bourguignon 2012-09-18 16:14:21 +02:00
parent d63b7de7cc
commit 8353cc1ca9
2 changed files with 5 additions and 4 deletions

View File

@ -22,6 +22,7 @@
import math
import openerp
from osv import osv, fields
from openerp import SUPERUSER_ID
import re
import tools
from tools.translate import _
@ -33,7 +34,7 @@ from lxml import etree
class format_address(object):
def fields_view_get_address(self, cr, uid, arch, context={}):
user_obj = self.pool.get('res.users')
fmt = user_obj.browse(cr, uid, uid,context).company_id.country_id
fmt = user_obj.browse(cr, SUPERUSER_ID, uid, context).company_id.country_id
fmt = fmt and fmt.address_format
layouts = {
'%(city)s %(state_code)s\n%(zip)s': """
@ -392,7 +393,7 @@ class res_partner(osv.osv, format_address):
- otherwise: default, everything is set as the name """
match = re.search(r'([^\s,<@]+@[^>\s,]+)', text)
if match:
email = match.group(1)
email = match.group(1)
name = text[:text.index(email)].replace('"','').replace('<','').strip()
else:
name, email = text, ''
@ -440,7 +441,7 @@ class res_partner(osv.osv, format_address):
def find_or_create(self, cr, uid, email, context=None):
""" Find a partner with the given ``email`` or use :py:method:`~.name_create`
to create one
:param str email: email-like string, which should contain at least one email,
e.g. ``"Raoul Grosbedon <r.g@grosbedon.fr>"``"""
assert email, 'an email is required for find_or_create to work'

View File

@ -264,7 +264,7 @@ class res_users(osv.osv):
# User can write on a few of his own fields (but not his groups for example)
SELF_WRITEABLE_FIELDS = ['password', 'signature', 'action_id', 'company_id', 'email', 'name', 'image', 'image_medium', 'image_small', 'lang', 'tz']
# User can read a few of his own fields
SELF_READABLE_FIELDS = ['signature', 'company_id', 'email', 'name', 'image', 'image_medium', 'image_small', 'lang', 'tz', 'groups_id', 'partner_id']
SELF_READABLE_FIELDS = ['signature', 'company_id', 'login', 'email', 'name', 'image', 'image_medium', 'image_small', 'lang', 'tz', 'groups_id', 'partner_id']
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
def override_password(o):