diff --git a/bin/addons/base/base_data.xml b/bin/addons/base/base_data.xml
index 411a40571d91adb3c3825382fedc486a7a5062a1..ca211b4a6d5e16e90c5ff590b09d6762fb8260f3 100644
--- a/bin/addons/base/base_data.xml
+++ b/bin/addons/base/base_data.xml
@@ -1046,9 +1046,16 @@
             <test expr="currency_id.code == 'eur'.upper()"/>
             <test expr="name">OpenERP S.A.</test>
         </assert>
-        <record id="user_admin" model="res.users">
+
+        <record model="res.users" id="base.user_root">
+            <field name="signature">Administrator</field>
+            <field name="address_id" ref="main_address"/>
             <field name="company_id" ref="main_company"/>
+            <field name="company_ids" eval="[(4, ref('main_company'))]"/>
+            <field name="action_id" ref="action_menu_admin"/>
+            <field name="menu_id" ref="action_menu_admin"/>
         </record>
+
         <record id="main_partner" model="res.partner">
             <field name="company_id" ref="main_company"/>
         </record>
diff --git a/bin/addons/base/i18n/hr.po b/bin/addons/base/i18n/hr.po
index bb79c90852db5647e300c1cd2d057bf2b225c9aa..38d9ec97851a6bb071bb4970f7fb846b3bcd69f4 100644
--- a/bin/addons/base/i18n/hr.po
+++ b/bin/addons/base/i18n/hr.po
@@ -7,13 +7,13 @@ msgstr ""
 "Project-Id-Version: OpenERP Server 5.0.4\n"
 "Report-Msgid-Bugs-To: support@openerp.com\n"
 "POT-Creation-Date: 2009-12-18 08:39+0000\n"
-"PO-Revision-Date: 2010-05-06 04:37+0000\n"
+"PO-Revision-Date: 2010-05-10 05:20+0000\n"
 "Last-Translator: goranc <goranc@gmail.com>\n"
 "Language-Team: openerp-translators\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-05-07 04:02+0000\n"
+"X-Launchpad-Export-Date: 2010-05-11 04:18+0000\n"
 "X-Generator: Launchpad (build Unknown)\n"
 "Language: hr\n"
 
diff --git a/bin/addons/base/i18n/ja.po b/bin/addons/base/i18n/ja.po
index d04e86ad4d3cfec1c26b2fd4c1dca79d1305736b..8c0c0f147652fc1160d22b0bd9b4f675120a4b51 100644
--- a/bin/addons/base/i18n/ja.po
+++ b/bin/addons/base/i18n/ja.po
@@ -8,13 +8,13 @@ msgstr ""
 "Project-Id-Version: openobject-server\n"
 "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
 "POT-Creation-Date: 2009-12-18 08:39+0000\n"
-"PO-Revision-Date: 2010-05-06 04:36+0000\n"
+"PO-Revision-Date: 2010-05-10 05:18+0000\n"
 "Last-Translator: Harry (Open ERP) <hmo@tinyerp.com>\n"
 "Language-Team: Japanese <ja@li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-05-07 04:02+0000\n"
+"X-Launchpad-Export-Date: 2010-05-11 04:18+0000\n"
 "X-Generator: Launchpad (build Unknown)\n"
 
 #. module: base
diff --git a/bin/addons/base/i18n/sv.po b/bin/addons/base/i18n/sv.po
index cf89b1b61d961608a3319fc6061b5a99bdc2d463..1d3907baf13fc8860ebd759645c08ded142c26e0 100644
--- a/bin/addons/base/i18n/sv.po
+++ b/bin/addons/base/i18n/sv.po
@@ -7,13 +7,13 @@ msgstr ""
 "Project-Id-Version: OpenERP Server 5.0.0\n"
 "Report-Msgid-Bugs-To: support@openerp.com\n"
 "POT-Creation-Date: 2009-12-18 08:39+0000\n"
-"PO-Revision-Date: 2010-05-06 04:38+0000\n"
+"PO-Revision-Date: 2010-05-10 05:19+0000\n"
 "Last-Translator: Anders Wallenquist <anders.wallenquist@vertel.se>\n"
 "Language-Team: <>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-05-07 04:02+0000\n"
+"X-Launchpad-Export-Date: 2010-05-11 04:18+0000\n"
 "X-Generator: Launchpad (build Unknown)\n"
 
 #. module: base
diff --git a/bin/addons/base/i18n/uk.po b/bin/addons/base/i18n/uk.po
index afa3de370eab66049caa75bc873fd5ea2163bb5e..a230acb479fe9b6a045004efb71f45dc88fae75b 100644
--- a/bin/addons/base/i18n/uk.po
+++ b/bin/addons/base/i18n/uk.po
@@ -7,13 +7,13 @@ msgstr ""
 "Project-Id-Version: OpenERP Server 5.0.0\n"
 "Report-Msgid-Bugs-To: support@openerp.com\n"
 "POT-Creation-Date: 2009-12-18 08:39+0000\n"
-"PO-Revision-Date: 2010-05-06 04:38+0000\n"
+"PO-Revision-Date: 2010-05-10 05:19+0000\n"
 "Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
 "Language-Team: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-05-07 04:02+0000\n"
+"X-Launchpad-Export-Date: 2010-05-11 04:18+0000\n"
 "X-Generator: Launchpad (build Unknown)\n"
 
 #. module: base
diff --git a/bin/addons/base/i18n/zh_CN.po b/bin/addons/base/i18n/zh_CN.po
index 6699f6e1f8f4cddb27588bef63f5c891aabd7aee..69c87a7ad0ca3d43e5cf00453e02d9438c9164ca 100644
--- a/bin/addons/base/i18n/zh_CN.po
+++ b/bin/addons/base/i18n/zh_CN.po
@@ -7,13 +7,13 @@ msgstr ""
 "Project-Id-Version: OpenERP Server 5.0.4\n"
 "Report-Msgid-Bugs-To: support@openerp.com\n"
 "POT-Creation-Date: 2009-12-18 08:39+0000\n"
-"PO-Revision-Date: 2010-05-06 04:38+0000\n"
+"PO-Revision-Date: 2010-05-10 05:19+0000\n"
 "Last-Translator: OpenERP Administrators <Unknown>\n"
 "Language-Team: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-05-07 04:02+0000\n"
+"X-Launchpad-Export-Date: 2010-05-11 04:18+0000\n"
 "X-Generator: Launchpad (build Unknown)\n"
 
 #. module: base
diff --git a/bin/addons/base/res/res_user.py b/bin/addons/base/res/res_user.py
index fe67848de6ae0ffdb6ff5777a04344519f446463..1542b58935cbca2fa3a573484e52210346df3c8c 100644
--- a/bin/addons/base/res/res_user.py
+++ b/bin/addons/base/res/res_user.py
@@ -210,6 +210,14 @@ class users(osv.osv):
                 result = map(override_password, result)
         return result
 
+
+    def _check_company(self, cr, uid, ids, context=None):
+        return all(((this.company_id in this.company_ids) or not this.company_ids) for this in self.browse(cr, uid, ids, context))
+
+    _constraints = [
+        (_check_company, 'The chosen company is not in the allowed companies', ['company_id', 'company_ids']),
+    ]
+
     _sql_constraints = [
         ('login_key', 'UNIQUE (login)',  _('You can not have two users with the same login !'))
     ]
@@ -225,13 +233,19 @@ class users(osv.osv):
         ids = self.pool.get('ir.ui.menu').search(cr, uid, [('usage','=','menu')])
         return ids and ids[0] or False
 
-    def _get_company(self,cr, uid, context={}, uid2=False):
+    def _get_company(self,cr, uid, context=None, uid2=False):
         if not uid2:
             uid2 = uid
         user = self.pool.get('res.users').read(cr, uid, uid2, ['company_id'], context)
         company_id = user.get('company_id', False)
         return company_id and company_id[0] or False
 
+    def _get_companies(self, cr, uid, context=None):
+        c = self._get_company(cr, uid, context)
+        if c:
+            return [c]
+        return False
+
     def _get_menu(self,cr, uid, context={}):
         ids = self.pool.get('ir.actions.act_window').search(cr, uid, [('usage','=','menu')])
         return ids and ids[0] or False
@@ -247,6 +261,7 @@ class users(osv.osv):
         'menu_id': _get_menu,
         'action_id': _get_menu,
         'company_id': _get_company,
+        'company_ids': _get_companies,
         'groups_id': _get_group,
         'address_id': False,
     }
diff --git a/bin/addons/base/security/base_security.xml b/bin/addons/base/security/base_security.xml
index 1059cf4da374c320b7be7735bbb4094b3d667eb9..ba5ea19a6c8208557e2673f93efdd4919b5a4c43 100644
--- a/bin/addons/base/security/base_security.xml
+++ b/bin/addons/base/security/base_security.xml
@@ -29,18 +29,6 @@
         <field name="name">Useability / No One</field>
     </record>
 
-<!--
- Users
--->
-    <record model="res.users" id="base.user_root">
-        <field name="signature">Administrator</field>
-        <field name="address_id" ref="main_address"/>
-        <field name="company_id" ref="main_company"/>
-        <field name="action_id" ref="action_menu_admin"/>
-        <field name="menu_id" ref="action_menu_admin"/>
-    </record>
-
-
     <!-- Set accesses to menu -->
     <record model="ir.ui.menu" id="base.menu_administration">
         <field name="groups_id" eval="[(6,0, [ref('group_system'), ref('group_erp_manager')])]"/>
diff --git a/bin/osv/orm.py b/bin/osv/orm.py
index 133f6cdda68efc7dcee1089ed9bf501a9d2a2872..6a96f22ff4047456e23668d29fa9e1f10b65e036 100644
--- a/bin/osv/orm.py
+++ b/bin/osv/orm.py
@@ -1153,12 +1153,8 @@ class orm_template(object):
         def check_group(node):
             if node.get('groups'):
                 groups = node.get('groups').split(',')
-                can_see = False
                 access_pool = self.pool.get('ir.model.access')
-                for group in groups:
-                    can_see = can_see or access_pool.check_groups(cr, user, group)
-                    if can_see:
-                        break
+                can_see = any(access_pool.check_groups(cr, user, group) for group in groups)
                 if not can_see:
                     node.set('invisible', '1')
                     if 'attrs' in node.attrib:
@@ -1199,7 +1195,8 @@ class orm_template(object):
                     column = False
 
                 if column:
-                    relation = column._obj
+                    relation = self.pool.get(column._obj)
+
                     childs = False
                     views = {}
                     for f in node:
@@ -1207,7 +1204,7 @@ class orm_template(object):
                             node.remove(f)
                             ctx = context.copy()
                             ctx['base_model_name'] = self._name
-                            xarch, xfields = self.pool.get(relation).__view_look_dom_arch(cr, user, f, view_id, ctx)
+                            xarch, xfields = relation.__view_look_dom_arch(cr, user, f, view_id, ctx)
                             views[str(f.tag)] = {
                                 'arch': xarch,
                                 'fields': xfields
@@ -1215,7 +1212,13 @@ class orm_template(object):
                     attrs = {'views': views}
                     if node.get('widget') and node.get('widget') == 'selection':
                         if not check_group(node):
-                            attrs['selection'] = []
+                            # the field is just invisible. default value must be in the selection
+                            name = node.get('name')
+                            default = self.default_get(cr, user, [name], context=context).get(name)
+                            if default:
+                                attrs['selection'] = relation.name_get(cr, 1, default, context=context)
+                            else:
+                                attrs['selection'] = []
                         # We can not use the 'string' domain has it is defined according to the record !
                         else:
                             dom = []
@@ -1223,7 +1226,7 @@ class orm_template(object):
                                 dom = column._domain
                             dom += eval(node.get('domain','[]'), {'uid':user, 'time':time})
                             context.update(eval(node.get('context','{}')))
-                            attrs['selection'] = self.pool.get(relation)._name_search(cr, user, '', dom, context=context, limit=None, name_get_uid=1)
+                            attrs['selection'] = relation._name_search(cr, user, '', dom, context=context, limit=None, name_get_uid=1)
                             if (node.get('required') and not int(node.get('required'))) or not column.required:
                                 attrs['selection'].append((False,''))
                 fields[node.get('name')] = attrs