[tryton-debian-vcs] tryton-server branch upstream-4.4 updated. upstream/4.4.6-1-g3a86e8c

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Sun Jan 7 13:03:20 UTC 2018


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

commit 3a86e8cfdb91bc2bfb759ebf90057076c0fbb127
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sat Jan 6 11:59:29 2018 +0100

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

diff --git a/CHANGELOG b/CHANGELOG
index 503af31..0d19dbb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.4.7 - 2018-01-04
+* Bug fixes (see mercurial logs for details)
+
 Version 4.4.6 - 2017-12-04
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index 411f7bd..23c41c7 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
 Copyright (C) 2004-2008 Tiny SPRL.
-Copyright (C) 2007-2017 Cédric Krier.
+Copyright (C) 2007-2018 Cédric Krier.
 Copyright (C) 2007-2013 Bertrand Chenal.
-Copyright (C) 2008-2017 B2CK SPRL.
+Copyright (C) 2008-2018 B2CK SPRL.
 Copyright (C) 2011 Openlabs Technologies & Consulting (P) Ltd.
 Copyright (C) 2011-2017 Nicolas Évrard.
 
diff --git a/PKG-INFO b/PKG-INFO
index e2b7790..ba7a32c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 4.4.6
+Version: 4.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 e2b7790..ba7a32c 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 4.4.6
+Version: 4.4.7
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond/__init__.py b/trytond/__init__.py
index 0e7f08e..b9688ac 100644
--- a/trytond/__init__.py
+++ b/trytond/__init__.py
@@ -5,7 +5,7 @@ import time
 import warnings
 from email import charset
 
-__version__ = "4.4.6"
+__version__ = "4.4.7"
 
 os.environ['TZ'] = 'UTC'
 if hasattr(time, 'tzset'):
diff --git a/trytond/model/fields/field.py b/trytond/model/fields/field.py
index 139d0f5..95cda07 100644
--- a/trytond/model/fields/field.py
+++ b/trytond/model/fields/field.py
@@ -365,10 +365,9 @@ class Field(object):
 class FieldTranslate(Field):
 
     def _get_translation_join(self, Model, name,
-            translation, model, table):
-        language = Transaction().language
+            translation, model, table, from_, language):
         if Model.__name__ == 'ir.model':
-            return table.join(translation, 'LEFT',
+            return from_.join(translation, 'LEFT',
                 condition=(translation.name == Concat(Concat(
                             table.model, ','), name))
                 & (translation.res_id == -1)
@@ -380,7 +379,7 @@ class FieldTranslate(Field):
                 type_ = 'field'
             else:
                 type_ = 'help'
-            return table.join(model, 'LEFT',
+            return from_.join(model, 'LEFT',
                 condition=model.id == table.model).join(
                     translation, 'LEFT',
                     condition=(translation.name == Concat(Concat(
@@ -390,7 +389,7 @@ class FieldTranslate(Field):
                     & (translation.type == type_)
                     & (translation.fuzzy == False))
         else:
-            return table.join(translation, 'LEFT',
+            return from_.join(translation, 'LEFT',
                 condition=(translation.res_id == table.id)
                 & (translation.name == '%s,%s' % (Model.__name__, name))
                 & (translation.lang == language)
@@ -398,6 +397,7 @@ class FieldTranslate(Field):
                 & (translation.fuzzy == False))
 
     def convert_domain(self, domain, tables, Model):
+        from trytond.tools import get_parent_language
         pool = Pool()
         Translation = pool.get('ir.translation')
         IrModel = pool.get('ir.model')
@@ -405,16 +405,20 @@ class FieldTranslate(Field):
             return super(FieldTranslate, self).convert_domain(
                 domain, tables, Model)
 
-        table = Model.__table__()
-        translation = Translation.__table__()
+        table = join = Model.__table__()
         model = IrModel.__table__()
         name, operator, value = domain
-        join = self._get_translation_join(Model, name,
-            translation, model, table)
+        language = Transaction().language
+        column = None
+        while language:
+            translation = Translation.__table__()
+            join = self._get_translation_join(
+                Model, name, translation, model, table, join, language)
+            column = Coalesce(NullIf(column, ''), translation.value)
+            language = get_parent_language(language)
+        column = Coalesce(NullIf(column, ''), self.sql_column(table))
         Operator = SQL_OPERATORS[operator]
         assert name == self.name
-        column = Coalesce(NullIf(translation.value, ''),
-            self.sql_column(table))
         where = Operator(column, self._domain_value(operator, value))
         if isinstance(where, operators.In) and not where.right:
             where = Literal(False)
@@ -424,6 +428,7 @@ class FieldTranslate(Field):
         return tables[None][0].id.in_(join.select(table.id, where=where))
 
     def convert_order(self, name, tables, Model):
+        from trytond.tools import get_parent_language
         pool = Pool()
         Translation = pool.get('ir.translation')
         IrModel = pool.get('ir.model')
@@ -433,28 +438,34 @@ class FieldTranslate(Field):
         assert name == self.name
 
         table, _ = tables[None]
-        key = name + '.translation'
-        if key not in tables:
-            translation = Translation.__table__()
-            model = IrModel.__table__()
-            join = self._get_translation_join(Model, name,
-                translation, model, table)
-            if join.left == table:
-                tables[key] = {
-                    None: (join.right, join.condition),
-                    }
-            else:
-                tables[key] = {
-                    None: (join.left.right, join.left.condition),
-                    'translation': {
+
+        join = table
+        language = Transaction().language
+        column = None
+        while language:
+            key = name + '.translation-' + language
+            if key not in tables:
+                translation = Translation.__table__()
+                model = IrModel.__table__()
+                join = self._get_translation_join(
+                    Model, name, translation, model, table, table, language)
+                if join.left == table:
+                    tables[key] = {
                         None: (join.right, join.condition),
-                        },
-                    }
-        else:
-            if 'translation' not in tables[key]:
-                translation, _ = tables[key][None]
+                        }
+                else:
+                    tables[key] = {
+                        None: (join.left.right, join.left.condition),
+                        'translation': {
+                            None: (join.right, join.condition),
+                            },
+                        }
             else:
-                translation, _ = tables[key]['translation'][None]
+                if 'translation' not in tables[key]:
+                    translation, _ = tables[key][None]
+                else:
+                    translation, _ = tables[key]['translation'][None]
+            column = Coalesce(NullIf(column, ''), translation.value)
+            language = get_parent_language(language)
 
-        return [Coalesce(NullIf(translation.value, ''),
-                self.sql_column(table))]
+        return [Coalesce(column, self.sql_column(table))]
-- 
tryton-server



More information about the tryton-debian-vcs mailing list