Reviewers: ,


Please review this at http://codereview.tryton.org/565002/

Affected files:
  M trytond/model/model.py


Index: trytond/model/model.py
===================================================================
--- a/trytond/model/model.py
+++ b/trytond/model/model.py
@@ -138,6 +138,14 @@
                     % (cls, field.name, name))

     @classmethod
+    def _get_info(cls):
+        info = cls.__doc__.splitlines()
+        for line in info:
+            line = line.strip()
+            if line:
+                return line
+
+    @classmethod
     def __register__(cls, module_name):
         """
         Add model in ir.model and ir.model.field.
@@ -160,7 +168,7 @@
         if not model_id:
             cursor.execute("INSERT INTO ir_model "
                 "(model, name, info, module) VALUES (%s, %s, %s, %s)",
-                (cls.__name__, cls.__doc__.splitlines()[0], cls.__doc__,
+                (cls.__name__, cls._get_info(), cls.__doc__,
                     module_name))
             Property._models_get_cache.clear()
             cursor.execute("SELECT id FROM ir_model WHERE model = %s",
@@ -171,7 +179,7 @@
                 'SET name = %s, '
                     'info = %s '
                 'WHERE id = %s',
-                (cls.__doc__.splitlines()[0], cls.__doc__, model_id))
+                (cls._get_info(), cls.__doc__, model_id))

         # Update translation of model
         if cls.__doc__:


--
[email protected] mailing list

Reply via email to