[MERGE] removed a few warnings.

bzr revid: vmt@openerp.com-20121116141502-v1z8w86o0bczgsk3
This commit is contained in:
Vo Minh Thu 2012-11-16 15:15:02 +01:00
commit eafc8fb4d3
11 changed files with 49 additions and 14 deletions

View File

@ -348,7 +348,8 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
for (model, name) in cr.fetchall():
model_obj = pool.get(model)
if model_obj and not model_obj.is_transient():
_logger.warning('Model %s (%s) has no access rules!', model, name)
_logger.warning('The model %s has no access rules, consider adding one. E.g. access_%s,access_%s,model_%s,,1,1,1,1',
model, model.replace('.', '_'), model.replace('.', '_'), model.replace('.', '_'))
# Temporary warning while we remove access rights on osv_memory objects, as they have
# been replaced by owner-only access rights

View File

@ -8,7 +8,7 @@
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'data': ['view.xml'],
'data': ['view.xml', 'ir.model.access.csv'],
'installable': True,
'auto_install': False,
}

View File

@ -0,0 +1,2 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
access_test_exceptions_model,access_test_exceptions_model,model_test_exceptions_model,,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_test_exceptions_model access_test_exceptions_model model_test_exceptions_model 1 1 1 1

View File

@ -8,7 +8,7 @@
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'data': [],
'data': ['ir.model.access.csv'],
'installable': True,
'auto_install': False,
}

View File

@ -0,0 +1,25 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
access_export_boolean,access_export_boolean,model_export_boolean,,1,1,1,1
access_export_integer,access_export_integer,model_export_integer,,1,1,1,1
access_export_float,access_export_float,model_export_float,,1,1,1,1
access_export_decimal,access_export_decimal,model_export_decimal,,1,1,1,1
access_export_string_bounded,access_export_string_bounded,model_export_string_bounded,,1,1,1,1
access_export_string_required,access_export_string_required,model_export_string_required,,1,1,1,1
access_export_string,access_export_string,model_export_string,,1,1,1,1
access_export_date,access_export_date,model_export_date,,1,1,1,1
access_export_datetime,access_export_datetime,model_export_datetime,,1,1,1,1
access_export_text,access_export_text,model_export_text,,1,1,1,1
access_export_selection,access_export_selection,model_export_selection,,1,1,1,1
access_export_selection_function,access_export_selection_function,model_export_selection_function,,1,1,1,1
access_export_many2one,access_export_many2one,model_export_many2one,,1,1,1,1
access_export_one2many,access_export_one2many,model_export_one2many,,1,1,1,1
access_export_many2many,access_export_many2many,model_export_many2many,,1,1,1,1
access_export_function,access_export_function,model_export_function,,1,1,1,1
access_export_one2many_child,access_export_one2many_child,model_export_one2many_child,,1,1,1,1
access_export_one2many_multiple,access_export_one2many_multiple,model_export_one2many_multiple,,1,1,1,1
access_export_one2many_multiple_child,access_export_one2many_multiple_child,model_export_one2many_multiple_child,,1,1,1,1
access_export_one2many_child_1,access_export_one2many_child_1,model_export_one2many_child_1,,1,1,1,1
access_export_one2many_child_2,access_export_one2many_child_2,model_export_one2many_child_2,,1,1,1,1
access_export_many2many_other,access_export_many2many_other,model_export_many2many_other,,1,1,1,1
access_export_selection_withdefault,access_export_selection_withdefault,model_export_selection_withdefault,,1,1,1,1
access_export_one2many_recursive,access_export_one2many_recursive,model_export_one2many_recursive,,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_export_boolean access_export_boolean model_export_boolean 1 1 1 1
3 access_export_integer access_export_integer model_export_integer 1 1 1 1
4 access_export_float access_export_float model_export_float 1 1 1 1
5 access_export_decimal access_export_decimal model_export_decimal 1 1 1 1
6 access_export_string_bounded access_export_string_bounded model_export_string_bounded 1 1 1 1
7 access_export_string_required access_export_string_required model_export_string_required 1 1 1 1
8 access_export_string access_export_string model_export_string 1 1 1 1
9 access_export_date access_export_date model_export_date 1 1 1 1
10 access_export_datetime access_export_datetime model_export_datetime 1 1 1 1
11 access_export_text access_export_text model_export_text 1 1 1 1
12 access_export_selection access_export_selection model_export_selection 1 1 1 1
13 access_export_selection_function access_export_selection_function model_export_selection_function 1 1 1 1
14 access_export_many2one access_export_many2one model_export_many2one 1 1 1 1
15 access_export_one2many access_export_one2many model_export_one2many 1 1 1 1
16 access_export_many2many access_export_many2many model_export_many2many 1 1 1 1
17 access_export_function access_export_function model_export_function 1 1 1 1
18 access_export_one2many_child access_export_one2many_child model_export_one2many_child 1 1 1 1
19 access_export_one2many_multiple access_export_one2many_multiple model_export_one2many_multiple 1 1 1 1
20 access_export_one2many_multiple_child access_export_one2many_multiple_child model_export_one2many_multiple_child 1 1 1 1
21 access_export_one2many_child_1 access_export_one2many_child_1 model_export_one2many_child_1 1 1 1 1
22 access_export_one2many_child_2 access_export_one2many_child_2 model_export_one2many_child_2 1 1 1 1
23 access_export_many2many_other access_export_many2many_other model_export_many2many_other 1 1 1 1
24 access_export_selection_withdefault access_export_selection_withdefault model_export_selection_withdefault 1 1 1 1
25 access_export_one2many_recursive access_export_one2many_recursive model_export_one2many_recursive 1 1 1 1

View File

@ -8,7 +8,7 @@
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'data': [],
'data': ['ir.model.access.csv'],
'installable': True,
'auto_install': False,
}

View File

@ -0,0 +1,2 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
access_test_limits_model,access_test_limits_model,model_test_limits_model,,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_test_limits_model access_test_limits_model model_test_limits_model 1 1 1 1

View File

@ -8,7 +8,7 @@
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'data': [],
'data': ['ir.model.access.csv'],
'installable': True,
'auto_install': False,
}

View File

@ -0,0 +1,2 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
access_test_uninstall_model,access_test_uninstall_model,model_test_uninstall_model,,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_test_uninstall_model access_test_uninstall_model model_test_uninstall_model 1 1 1 1

View File

@ -9,8 +9,8 @@ import common
DB = common.DB
ADMIN_USER_ID = common.ADMIN_USER_ID
def cursor():
return openerp.modules.registry.RegistryManager.get(DB).db.cursor()
def registry():
return openerp.modules.registry.RegistryManager.get(DB)
class test_cr_execute(unittest2.TestCase):
@ -21,12 +21,12 @@ class test_cr_execute(unittest2.TestCase):
"""
Try to use iterable but non-list or int params in query parameters.
"""
cr = cursor()
with self.assertRaises(ValueError):
cr.execute("SELECT id FROM res_users WHERE login=%s", 'admin')
with self.assertRaises(ValueError):
cr.execute("SELECT id FROM res_users WHERE id=%s", 1)
with self.assertRaises(ValueError):
cr.execute("SELECT id FROM res_users WHERE id=%s", '1')
with registry().cursor(auto_commit=False) as cr:
with self.assertRaises(ValueError):
cr.execute("SELECT id FROM res_users WHERE login=%s", 'admin')
with self.assertRaises(ValueError):
cr.execute("SELECT id FROM res_users WHERE id=%s", 1)
with self.assertRaises(ValueError):
cr.execute("SELECT id FROM res_users WHERE id=%s", '1')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -109,6 +109,7 @@ class TestInherits(common.TransactionCase):
self.assertEqual(foo.name, 'Foo')
self.assertEqual(foo.partner_id.id, par_id)
@mute_logger('openerp.osv.orm')
def test_read(self):
""" inherited fields should be read without any indirection """
foo_id = self.user.create(self.cr, UID, {'name': 'Foo', 'login': 'foo', 'password': 'foo'})
@ -120,6 +121,7 @@ class TestInherits(common.TransactionCase):
foo = self.user.browse(self.cr, UID, foo_id)
self.assertEqual(foo.name, foo.partner_id.name)
@mute_logger('openerp.osv.orm')
def test_copy(self):
""" copying a user should automatically copy its partner, too """
foo_id = self.user.create(self.cr, UID, {'name': 'Foo', 'login': 'foo', 'password': 'foo'})
@ -134,6 +136,7 @@ class TestInherits(common.TransactionCase):
self.assertNotEqual(foo.id, bar.id)
self.assertNotEqual(foo.partner_id.id, bar.partner_id.id)
@mute_logger('openerp.osv.orm')
def test_copy_with_ancestor(self):
""" copying a user with 'parent_id' in defaults should not duplicate the partner """
foo_id = self.user.create(self.cr, UID, {'name': 'Foo', 'login': 'foo', 'password': 'foo'})