[tryton-debian-vcs] tryton-server branch upstream-3.6 updated. upstream/3.6.3-1-g3830632

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Fri Nov 13 19:32:01 UTC 2015


The following commit has been merged in the upstream-3.6 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-server.git;a=commitdiff;h=upstream/3.6.3-1-g3830632

commit 38306323cd081fedeeb0aa12c6c663d5a2ee3689
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Fri Nov 13 18:28:45 2015 +0100

    Adding upstream version 3.6.4.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/CHANGELOG b/CHANGELOG
index fcdd386..ccdaba8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.6.4 - 2015-11-09
+* Bug fixes (see mercurial logs for details)
+
 Version 3.6.3 - 2015-09-07
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 061bee8..c90cff5 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 3.6.3
+Version: 3.6.4
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index 061bee8..c90cff5 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 3.6.3
+Version: 3.6.4
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond/__init__.py b/trytond/__init__.py
index 3ddf272..04005d0 100644
--- a/trytond/__init__.py
+++ b/trytond/__init__.py
@@ -4,7 +4,7 @@ import os
 import time
 from email import charset
 
-__version__ = "3.6.3"
+__version__ = "3.6.4"
 
 os.environ['TZ'] = 'UTC'
 if hasattr(time, 'tzset'):
diff --git a/trytond/convert.py b/trytond/convert.py
index fea9638..8d2cbc4 100644
--- a/trytond/convert.py
+++ b/trytond/convert.py
@@ -792,9 +792,9 @@ def post_import(pool, module, to_delete):
             ], order=[('id', 'DESC')])
 
     for mrec in mdata:
-        model, db_id = mrec.model, mrec.db_id
+        model, db_id, fs_id = mrec.model, mrec.db_id, mrec.fs_id
 
-        logger.info('Deleting %s@%s', db_id, model)
+        logger.info('Deleting %s@%s from %s.%s', db_id, model, module, fs_id)
         try:
             # Deletion of the record
             try:
@@ -819,9 +819,15 @@ def post_import(pool, module, to_delete):
                 'and restart --update=module\n',
                 db_id, model, exc_info=True)
             if 'active' in Model._fields:
-                Model.write([Model(db_id)], {
-                        'active': False,
-                        })
+                try:
+                    Model.write([Model(db_id)], {
+                            'active': False,
+                            })
+                except Exception:
+                    cursor.rollback()
+                    logger.error(
+                        'Could not inactivate id: %d of model %s\n',
+                        db_id, model, exc_info=True)
 
     # Clean model_data:
     if mdata_delete:
diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py
index 8a76e54..366239d 100644
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -972,7 +972,7 @@ class ModelSQL(ModelStorage):
                 cursor.execute(*table.delete(where=red_sql))
             except DatabaseIntegrityError, exception:
                 with Transaction().new_cursor():
-                    cls.__raise_integrity_error(exception, [])
+                    cls.__raise_integrity_error(exception, {})
                 raise
 
         Translation.delete_ids(cls.__name__, 'model', ids)
@@ -1198,10 +1198,24 @@ class ModelSQL(ModelStorage):
                     raise Exception('ValidateError',
                         'You can not update fields: "%s", "%s"' %
                         (field.left, field.right))
+
+                # Nested creation require a rebuild
+                # because initial values are 0
+                # and thus _update_tree can not find the children
+                table = cls.__table__()
+                parent = cls.__table__()
+                cursor.execute(*table.join(parent,
+                        condition=Column(table, field_name) == parent.id
+                        ).select(table.id,
+                        where=(Column(parent, field.left) == 0)
+                        & (Column(parent, field.right) == 0)))
+                nested_create = cursor.fetchone()
+
                 if count is None:
-                    cursor.execute(*cls.__table__().select(Count(Literal(1))))
+                    cursor.execute(*table.select(Count(Literal(1))))
                     count, = cursor.fetchone()
-                if len(ids) < count / 4:
+
+                if not nested_create and len(ids) < count / 4:
                     for id_ in ids:
                         cls._update_tree(id_, field_name,
                             field.left, field.right)
diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py
index 68eb97c..3bf8269 100644
--- a/trytond/model/modelstorage.py
+++ b/trytond/model/modelstorage.py
@@ -297,9 +297,18 @@ class ModelStorage(Model):
                 del data['id']
             return data
 
+        # Reset MPTT field to the default value
+        mptt = set()
+        for field in cls._fields.itervalues():
+            if (isinstance(field, fields.Many2One)
+                    and field.model_name == cls.__name__
+                    and field.left and field.right):
+                mptt.add(field.left)
+                mptt.add(field.right)
         fields_names = [n for n, f in cls._fields.iteritems()
             if (not isinstance(f, fields.Function)
-                or isinstance(f, fields.Property))]
+                or isinstance(f, fields.Property))
+            and n not in mptt]
         ids = map(int, records)
         datas = cls.read(ids, fields_names=fields_names)
         datas = dict((d['id'], d) for d in datas)
diff --git a/trytond/tests/test_tryton.py b/trytond/tests/test_tryton.py
index ec91336..979b2f1 100644
--- a/trytond/tests/test_tryton.py
+++ b/trytond/tests/test_tryton.py
@@ -100,7 +100,10 @@ class ModuleTestCase(unittest.TestCase):
                     ('model', '!=', ''),
                     ])
             for view in views:
-                view_id = view.inherit and view.inherit.id or view.id
+                if view.inherit and view.inherit.model == view.model:
+                    view_id = view.inherit.id
+                else:
+                    view_id = view.id
                 model = view.model
                 Model = POOL.get(model)
                 res = Model.fields_view_get(view_id)
-- 
tryton-server



More information about the tryton-debian-vcs mailing list