Fix inheritance in __init__
- Add field only if pool is not None - Don't append to mutable object because they are static in ORM object so they will be change for all objects
This commit is contained in:
1 parent
ac5cf79812
commit
b38c97bd4a
10 files changed
+66
-53
No files matched your search
@@ -61,9 +61,10 @@ class ActionKeyword(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(ActionKeyword, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'get_keyword',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'get_keyword',
|
||||
]
|
||||
|
||||
def _convert_vals(self, cursor, user, vals, context=None):
|
||||
vals = vals.copy()
|
||||
|
||||
@@ -166,15 +166,16 @@ class Module(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(Module, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'button_install',
|
||||
'button_install_cancel',
|
||||
'button_uninstall',
|
||||
'button_uninstall_cancel',
|
||||
'button_upgrade',
|
||||
'button_upgrade_cancel',
|
||||
'button_update_translations',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'button_install',
|
||||
'button_install_cancel',
|
||||
'button_uninstall',
|
||||
'button_uninstall_cancel',
|
||||
'button_upgrade',
|
||||
'button_upgrade_cancel',
|
||||
'button_update_translations',
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def get_module_info(name):
|
||||
|
||||
@@ -17,10 +17,11 @@ class Property(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(Property, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'models_get2',
|
||||
'models_get',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'models_get2',
|
||||
'models_get',
|
||||
]
|
||||
|
||||
def models_get2(self, cursor, user, context=None):
|
||||
model_fields_obj = self.pool.get('ir.model.fields')
|
||||
|
||||
+4
-3
@@ -75,9 +75,10 @@ class Rule(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(Rule, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'operand',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'operand',
|
||||
]
|
||||
|
||||
def operand(self, cursor, user, context):
|
||||
|
||||
|
||||
@@ -38,9 +38,10 @@ class Sequence(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(Sequence, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'code_get',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'code_get',
|
||||
]
|
||||
|
||||
def code_get(self, cursor, user, context=None):
|
||||
cursor.execute('select code, name from ir_sequence_type')
|
||||
|
||||
+13
-10
@@ -56,9 +56,10 @@ class Translation(OSV, Cacheable):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(Translation, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'get_language',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'get_language',
|
||||
]
|
||||
|
||||
def model(self, cursor, user, ids, name, arg, context=None):
|
||||
res = {}
|
||||
@@ -376,9 +377,10 @@ class TranslationUpdateInit(WizardOSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(TranslationUpdateInit, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'get_language',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'get_language',
|
||||
]
|
||||
|
||||
def get_language(self, cursor, user, context):
|
||||
lang_obj = self.pool.get('ir.lang')
|
||||
@@ -508,10 +510,11 @@ class TranslationExportInit(WizardOSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(TranslationExportInit, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'get_language',
|
||||
'get_module',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'get_language',
|
||||
'get_module',
|
||||
]
|
||||
|
||||
def get_language(self, cursor, user, context):
|
||||
lang_obj = self.pool.get('ir.lang')
|
||||
|
||||
@@ -182,9 +182,10 @@ class ViewShortcut(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(ViewShortcut, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'get_sc',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'get_sc',
|
||||
]
|
||||
|
||||
def get_sc(self, cursor, user, user_id, model='ir.ui.menu', context=None):
|
||||
"Provide user's shortcuts"
|
||||
|
||||
@@ -67,13 +67,14 @@ class Request(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(Request, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'links_get',
|
||||
'request_send',
|
||||
'request_reply',
|
||||
'request_close',
|
||||
'request_get',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'links_get',
|
||||
'request_send',
|
||||
'request_reply',
|
||||
'request_close',
|
||||
'request_get',
|
||||
]
|
||||
|
||||
def links_get(self, cursor, user, context=None):
|
||||
request_link_obj = self.pool.get('res.request.link')
|
||||
|
||||
+11
-9
@@ -84,13 +84,14 @@ class User(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(User, self).__init__(pool)
|
||||
self._rpc_allowed.extend([
|
||||
'get_preferences',
|
||||
'set_preferences',
|
||||
'get_preferences_fields_view',
|
||||
'languages',
|
||||
'timezones',
|
||||
])
|
||||
if pool:
|
||||
self._rpc_allowed = self._rpc_allowed + [
|
||||
'get_preferences',
|
||||
'set_preferences',
|
||||
'get_preferences_fields_view',
|
||||
'languages',
|
||||
'timezones',
|
||||
]
|
||||
|
||||
def _convert_vals(self, cursor, user, vals, context=None):
|
||||
vals = vals.copy()
|
||||
@@ -205,7 +206,8 @@ class Group2(Group):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(Group2, self).__init__(pool)
|
||||
self._columns['users'] = fields.many2many(
|
||||
'res.user', 'res_group_user_rel', 'gid', 'uid', 'Users')
|
||||
if pool:
|
||||
self._columns['users'] = fields.many2many(
|
||||
'res.user', 'res_group_user_rel', 'gid', 'uid', 'Users')
|
||||
|
||||
Group2()
|
||||
@@ -301,12 +301,13 @@ class Attachment(OSV):
|
||||
|
||||
def __init__(self, pool):
|
||||
super(Attachment, self).__init__(pool)
|
||||
self._constraints = self._constraints + [
|
||||
if pool:
|
||||
self._constraints = self._constraints + [
|
||||
('check_directory',
|
||||
'Error! You can not create a attachment \n' \
|
||||
'on a directory that have the same name \n' \
|
||||
'than a child directory.', ['name']),
|
||||
]
|
||||
]
|
||||
|
||||
def check_directory(self, cursor, user, ids):
|
||||
directory_obj = self.pool.get('webdav.directory')
|
||||
|
||||
Reference in new issue
Block a user