[tryton-debian-vcs] tryton-server branch upstream-3.0 updated. upstream/3.0.11-1-ga6117ed

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

commit a6117edfa1d68ff80b4f13c2d30fde8d036835f5
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Fri Nov 13 18:23:05 2015 +0100

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

diff --git a/CHANGELOG b/CHANGELOG
index fd78e07..4f8bd30 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.0.12 - 2015-11-09
+* Bug fixes (see mercurial logs for details)
+
 Version 3.0.11 - 2015-05-19
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 20952a1..397c7ff 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 3.0.11
+Version: 3.0.12
 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 20952a1..397c7ff 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.0.11
+Version: 3.0.12
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond/convert.py b/trytond/convert.py
index 259db7f..0f97c19 100644
--- a/trytond/convert.py
+++ b/trytond/convert.py
@@ -756,10 +756,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:
@@ -783,9 +783,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 798a893..b6d7bb2 100644
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -849,7 +849,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)
@@ -1063,10 +1063,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 806db49..db83edf 100644
--- a/trytond/model/modelstorage.py
+++ b/trytond/model/modelstorage.py
@@ -281,9 +281,18 @@ class ModelStorage(Model):
             return data, data_o2m
 
         new_ids = {}
+        # 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)
         field_defs = cls.fields_get(fields_names=fields_names)
diff --git a/trytond/version.py b/trytond/version.py
index 99f6dec..21df2d7 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.0.11"
+VERSION = "3.0.12"
 LICENSE = "GPL-3"
 WEBSITE = "http://www.tryton.org/"
-- 
tryton-server



More information about the tryton-debian-vcs mailing list