Xavier (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-server/trunk-fields-related-fixes-xmo into 
lp:openobject-server.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-fields-related-fixes-xmo/+merge/116297

A bunch of minor improvements to fields handlings:
* Removal of useless or redundant code
* Made all of field.char's arguments optional
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-fields-related-fixes-xmo/+merge/116297
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/trunk-fields-related-fixes-xmo.
=== modified file 'openerp/osv/fields.py'
--- openerp/osv/fields.py	2012-05-21 07:38:51 +0000
+++ openerp/osv/fields.py	2012-07-23 14:31:21 +0000
@@ -49,7 +49,7 @@
 _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 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 @@
         # * 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

=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py	2012-07-02 16:20:22 +0000
+++ openerp/osv/orm.py	2012-07-23 14:31:21 +0000
@@ -758,7 +758,7 @@
                 '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 @@
                 '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):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to