diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index 2a6d0d6e3eb..b7f47fe6549 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -49,7 +49,7 @@ import simplejson _logger = logging.getLogger(__name__) def _symbol_set(symb): - if symb == None or symb == False: + if symb is None or symb == False: return None elif isinstance(symb, unicode): return symb.encode('utf-8') @@ -181,8 +181,8 @@ class reference(_column): class char(_column): _type = 'char' - def __init__(self, string, size, **args): - _column.__init__(self, string=string, size=size, **args) + def __init__(self, string="unknown", size=None, **args): + _column.__init__(self, string=string, size=size or None, **args) self._symbol_set = (self._symbol_c, self._symbol_set_char) # takes a string (encoded in utf8) and returns a string (encoded in utf8) @@ -191,7 +191,7 @@ class char(_column): # * we need to remove the "symb==False" from the next line BUT # for now too many things rely on this broken behavior # * the symb==None test should be common to all data types - if symb == None or symb == False: + if symb is None or symb == False: return None # we need to convert the string to a unicode object to be able diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 78487e7641c..a62561fc95d 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -758,7 +758,7 @@ class BaseModel(object): 'model_id': model_id, 'model': self._name, 'name': k, - 'field_description': f.string.replace("'", " "), + 'field_description': f.string, 'ttype': f._type, 'relation': f._obj or '', 'view_load': (f.view_load and 1) or 0, @@ -767,7 +767,7 @@ class BaseModel(object): 'required': (f.required and 1) or 0, 'selectable': (f.selectable and 1) or 0, 'translate': (f.translate and 1) or 0, - 'relation_field': (f._type=='one2many' and isinstance(f, fields.one2many)) and f._fields_id or '', + 'relation_field': f._fields_id if isinstance(f, fields.one2many) else '', 'serialization_field_id': None, } if getattr(f, 'serialization_field', None):