diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 851f5d4d432..c6186b9a052 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -64,6 +64,10 @@ class _column(object): _symbol_get = None def __init__(self, string='unknown', required=False, readonly=False, domain=None, context=None, states=None, priority=0, change_default=False, size=None, ondelete="set null", translate=False, select=False, **args): + if domain is None: + domain = [] + if context is None: + context = {} self.states = states or {} self.string = string self.readonly = readonly @@ -74,8 +78,8 @@ class _column(object): self.change_default = change_default self.ondelete = ondelete self.translate = translate - self._domain = domain or [] - self._context = context or {} + self._domain = domain + self._context = context self.write = False self.read = False self.view_load = 0 diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 4d63bdd805a..c5a47d1201f 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -131,6 +131,10 @@ class browse_record(object): table : the object (inherited from orm) context : dictionary with an optional context ''' + if fields_process is None: + domain = {} + if context is None: + context = {} self._list_class = list_class or browse_record_list self._cr = cr self._uid = uid @@ -139,8 +143,8 @@ class browse_record(object): self._table_name = self._table._name self.__logger = logging.getLogger( 'osv.browse_record.' + self._table_name) - self._context = context or {} - self._fields_process = fields_process or {} + self._context = context + self._fields_process = fields_process cache.setdefault(table._name, {}) self._data = cache[table._name]