[FIX] openerp/osv/fields: fix method to_field() to pass some falsy parameters.
For instance, the attribute copy=False was not passed when converting the _column to a Field. Simply make sure those parameter are always passed.
This commit is contained in:
parent
38668fd404
commit
10142d7dc7
|
@ -42,6 +42,7 @@ import logging
|
||||||
import pytz
|
import pytz
|
||||||
import re
|
import re
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
|
from operator import itemgetter
|
||||||
from psycopg2 import Binary
|
from psycopg2 import Binary
|
||||||
|
|
||||||
import openerp
|
import openerp
|
||||||
|
@ -115,6 +116,7 @@ class _column(object):
|
||||||
self.group_operator = args.get('group_operator', False)
|
self.group_operator = args.get('group_operator', False)
|
||||||
self.groups = False # CSV list of ext IDs of groups that can access this field
|
self.groups = False # CSV list of ext IDs of groups that can access this field
|
||||||
self.deprecated = False # Optional deprecation warning
|
self.deprecated = False # Optional deprecation warning
|
||||||
|
self._args = args
|
||||||
for a in args:
|
for a in args:
|
||||||
setattr(self, a, args[a])
|
setattr(self, a, args[a])
|
||||||
|
|
||||||
|
@ -130,7 +132,7 @@ class _column(object):
|
||||||
|
|
||||||
def to_field_args(self):
|
def to_field_args(self):
|
||||||
""" return a dictionary with all the arguments to pass to the field """
|
""" return a dictionary with all the arguments to pass to the field """
|
||||||
items = [
|
base_items = [
|
||||||
('column', self), # field interfaces self
|
('column', self), # field interfaces self
|
||||||
('copy', self.copy),
|
('copy', self.copy),
|
||||||
('index', self.select),
|
('index', self.select),
|
||||||
|
@ -141,15 +143,17 @@ class _column(object):
|
||||||
('required', self.required),
|
('required', self.required),
|
||||||
('states', self.states),
|
('states', self.states),
|
||||||
('groups', self.groups),
|
('groups', self.groups),
|
||||||
|
('change_default', self.change_default),
|
||||||
|
('deprecated', self.deprecated),
|
||||||
|
]
|
||||||
|
truthy_items = filter(itemgetter(1), [
|
||||||
('size', self.size),
|
('size', self.size),
|
||||||
('ondelete', self.ondelete),
|
('ondelete', self.ondelete),
|
||||||
('translate', self.translate),
|
('translate', self.translate),
|
||||||
('domain', self._domain),
|
('domain', self._domain),
|
||||||
('context', self._context),
|
('context', self._context),
|
||||||
('change_default', self.change_default),
|
])
|
||||||
('deprecated', self.deprecated),
|
return dict(base_items + truthy_items + self._args.items())
|
||||||
]
|
|
||||||
return dict(item for item in items if item[1])
|
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue