[tryton-debian-vcs] tryton-server branch upstream-3.4 updated. upstream/3.4.6-1-g4afcefa

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.4 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-server.git;a=commitdiff;h=upstream/3.4.6-1-g4afcefa

commit 4afcefa6e963f3d274199d0f23f34a98febcb2ed
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Fri Nov 13 18:27:10 2015 +0100

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

diff --git a/CHANGELOG b/CHANGELOG
index f3a7d4a..75621ca 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.4.7 - 2015-11-09
+* Bug fixes (see mercurial logs for details)
+
 Version 3.4.6 - 2015-09-07
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index fb40109..023e5aa 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 3.4.6
+Version: 3.4.7
 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 fb40109..023e5aa 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.4.6
+Version: 3.4.7
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond/convert.py b/trytond/convert.py
index 8d5515c..e23f18a 100644
--- a/trytond/convert.py
+++ b/trytond/convert.py
@@ -794,10 +794,10 @@ def post_import(pool, module, to_delete):
 
     object_name_list = set(pool.object_name_list())
     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
 
         logging.getLogger("convert").info(
-                'Deleting %s@%s' % (db_id, model))
+            'Deleting %s@%s from %s.%s', db_id, model, module, fs_id)
         try:
             # Deletion of the record
             if model in object_name_list:
@@ -821,9 +821,15 @@ def post_import(pool, module, to_delete):
                     'Exception: %s' %
                     (db_id, model, tb_s))
             if 'active' in Model._fields:
-                Model.write([Model(db_id)], {
-                        'active': False,
-                        })
+                try:
+                    Model.write([Model(db_id)], {
+                            'active': False,
+                            })
+                except Exception:
+                    cursor.rollback()
+                    logging.getLogger("convert").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 1fba365..559d885 100644
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -952,7 +952,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)
@@ -1177,10 +1177,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 a33d5fc..f0e445f 100644
--- a/trytond/model/modelstorage.py
+++ b/trytond/model/modelstorage.py
@@ -289,9 +289,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/version.py b/trytond/version.py
index d4f9a2c..53ab20a 100644
--- a/trytond/version.py
+++ b/trytond/version.py
@@ -1,6 +1,6 @@
 #This file is part of Tryton.  The COPYRIGHT file at the top level of
 #this repository contains the full copyright notices and license terms.
 PACKAGE = "trytond"
-VERSION = "3.4.6"
+VERSION = "3.4.7"
 LICENSE = "GPL-3"
 WEBSITE = "http://www.tryton.org/"
-- 
tryton-server



More information about the tryton-debian-vcs mailing list