[tryton-debian-vcs] tryton-server branch upstream-1.6 created. c2ffd292f273c0117e8627b91f05adc016a5d8e6

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Nov 27 17:15:14 UTC 2013


The following commit has been merged in the upstream-1.6 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-server.git;a=commitdiff;h=c2ffd292f273c0117e8627b91f05adc016a5d8e6
commit c2ffd292f273c0117e8627b91f05adc016a5d8e6
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sat Nov 20 14:07:43 2010 +0100

    Adding upstream version 1.6.2.

diff --git a/CHANGELOG b/CHANGELOG
index a1aed9a..f287299 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 1.6.2 - 2010-11-02
+* Bug fixes (see mercurial logs for details)
+
 Version 1.6.1 - 2010-07-29
 * Bug fixes (see mercurial logs for details)
 * Make _timestamp numeric instead of datetime to work with XML-RPC and JSON-RPC
diff --git a/PKG-INFO b/PKG-INFO
index 6e68007..dc7d3d7 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: trytond
-Version: 1.6.1
+Version: 1.6.2
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: B2CK
diff --git a/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index 6e68007..dc7d3d7 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: trytond
-Version: 1.6.1
+Version: 1.6.2
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: B2CK
diff --git a/trytond/backend/postgresql/database.py b/trytond/backend/postgresql/database.py
index d737148..f88caf1 100644
--- a/trytond/backend/postgresql/database.py
+++ b/trytond/backend/postgresql/database.py
@@ -10,6 +10,10 @@ from psycopg2.extensions import ISOLATION_LEVEL_SERIALIZABLE
 from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
 from psycopg2.extensions import register_type, register_adapter
 from psycopg2.extensions import UNICODE, AsIs
+try:
+    from psycopg2.extensions import PYDATE, PYDATETIME, PYTIME
+except ImportError:
+    PYDATE, PYDATETIME, PYTIME = None, None, None
 from psycopg2 import IntegrityError as DatabaseIntegrityError
 from psycopg2 import OperationalError as DatabaseOperationalError
 import time
@@ -19,6 +23,7 @@ import os
 if os.name == 'posix':
     import pwd
 from decimal import Decimal
+from trytond.protocols.datatype import Float
 
 RE_FROM = re.compile('.* from "?([a-zA-Z_0-9]+)"?.*$')
 RE_INTO = re.compile('.* into "?([a-zA-Z_0-9]+)"?.*$')
@@ -395,6 +400,13 @@ class Cursor(CursorInterface):
         return select
 
 register_type(UNICODE)
+if PYDATE:
+    register_type(PYDATE)
+if PYDATETIME:
+    register_type(PYDATETIME)
+if PYTIME:
+    register_type(PYTIME)
 register_adapter(Session, AsIs)
 register_adapter(float, lambda value: AsIs(repr(value)))
+register_adapter(Float, lambda value: AsIs(repr(value)))
 register_adapter(Decimal, lambda value: AsIs(str(value)))
diff --git a/trytond/ir/rule.py b/trytond/ir/rule.py
index 7711d5f..74cf632 100644
--- a/trytond/ir/rule.py
+++ b/trytond/ir/rule.py
@@ -148,6 +148,11 @@ class Rule(ModelSQL, ModelView):
         assert mode in ['read', 'write', 'create', 'delete'], \
                 'Invalid domain mode for security'
 
+        # Fix for issue1661
+        if (model_name in ('ir.sequence', 'ir.sequence.strict')
+                and mode == 'read'):
+            return '', []
+
         # root user above constraint
         if user == 0:
             if not context.get('user'):
diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py
index 65e0e39..6853a92 100644
--- a/trytond/ir/translation.py
+++ b/trytond/ir/translation.py
@@ -687,9 +687,9 @@ class ReportTranslationSet(Wizard):
                 if not done:
                     cursor.execute('INSERT INTO ir_translation ' \
                             '(name, lang, type, src, value, module, fuzzy)' \
-                            'VALUES (%s, %s, %s, %s, %s, %s, False)',
+                            'VALUES (%s, %s, %s, %s, %s, %s, %s)',
                             (report.report_name, 'en_US', 'odt', string, '',
-                                report.module))
+                                report.module, False))
             if strings:
                 cursor.execute('DELETE FROM ir_translation ' \
                         'WHERE name = %s ' \
diff --git a/trytond/ir/ui/form.rnc b/trytond/ir/ui/form.rnc
index 83c2eec..ecda2bd 100644
--- a/trytond/ir/ui/form.rnc
+++ b/trytond/ir/ui/form.rnc
@@ -206,6 +206,7 @@ attlist.group &= [ a:defaultValue = "1" ] attribute fill { "0" | "1" }?
 attlist.group &= [ a:defaultValue = "1" ] attribute rowspan { text }?
 attlist.group &= [ a:defaultValue = "4" ] attribute col { text }?
 attlist.group &= ( attribute name { text } | attribute id { text } )
+attlist.group &= attribute states { text }?
 
 hpaned = element hpaned { attlist.paned, child* }
 
diff --git a/trytond/ir/ui/form.rng b/trytond/ir/ui/form.rng
index 91133a8..ba1c5c2 100644
--- a/trytond/ir/ui/form.rng
+++ b/trytond/ir/ui/form.rng
@@ -747,6 +747,11 @@
       <attribute name="id"/>
     </choice>
   </define>
+  <define name="attlist.group" combine="interleave">
+    <optional>
+      <attribute name="states"/>
+    </optional>
+  </define>
   <define name="hpaned">
     <element name="hpaned">
       <ref name="attlist.paned"/>
diff --git a/trytond/model/model.py b/trytond/model/model.py
index f4a766d..8e5b420 100644
--- a/trytond/model/model.py
+++ b/trytond/model/model.py
@@ -101,33 +101,30 @@ class Model(object):
                     self._rpc[on_change_with] = False
 
     def __getattr__(self, name):
-        try:
-            super(Model, self).__getattr__(name)
-        except AttributeError:
-            # Search if a function exists in inherits parents
-            for model_name, field_name in self._inherits.iteritems():
-                model_obj = self.pool.get(model_name)
-                if hasattr(model_obj, name) and \
-                        callable(getattr(model_obj, name)):
-                    def func(cursor, user, *args, **kwargs):
-                        if args:
-                            ids = args[0]
-                            int_id = False
-                            if isinstance(ids, (int, long)):
-                                int_id = True
-                                ids = [ids]
-                            if reduce(lambda x, y: x and
-                                    isinstance(y, (int, long)), ids, True):
-                                # Replace ids by the parent ids
-                                ids = [getattr(x, field_name).id for x in
-                                        self.browse(cursor, user, ids)]
-                            if int_id:
-                                ids = ids[0]
-                            args = tuple([ids] + list(args[1:]))
-                        return getattr(model_obj, name)(cursor, user, *args,
-                                **kwargs)
-                    return func
-            raise
+        # Search if a function exists in inherits parents
+        for model_name, field_name in self._inherits.iteritems():
+            model_obj = self.pool.get(model_name)
+            if hasattr(model_obj, name) and \
+                    callable(getattr(model_obj, name)):
+                def func(cursor, user, *args, **kwargs):
+                    if args:
+                        ids = args[0]
+                        int_id = False
+                        if isinstance(ids, (int, long)):
+                            int_id = True
+                            ids = [ids]
+                        if reduce(lambda x, y: x and
+                                isinstance(y, (int, long)), ids, True):
+                            # Replace ids by the parent ids
+                            ids = [getattr(x, field_name).id for x in
+                                    self.browse(cursor, user, ids)]
+                        if int_id:
+                            ids = ids[0]
+                        args = tuple([ids] + list(args[1:]))
+                    return getattr(model_obj, name)(cursor, user, *args,
+                            **kwargs)
+                return func
+        raise AttributeError
 
     def _inherits_reload(self):
         """
diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py
index 336bd16..97f509f 100644
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -1034,6 +1034,8 @@ class ModelSQL(ModelStorage):
             if hasattr(model, 'table_query') \
                     and model.table_query(context):
                 continue
+            if not isinstance(model, ModelStorage):
+                continue
             for field_name, field in model._columns.iteritems():
                 if isinstance(field, fields.Many2One) \
                         and field.model_name == self._name:
@@ -1537,36 +1539,30 @@ class ModelSQL(ModelStorage):
                             domain[i] = ('id', 'not in', ids2 + _rec_get(ids2,
                                 table, domain[i][0]))
                 else:
-                    if isinstance(domain[i][2], basestring):
-                        res_ids = [x[0] for x in target_obj.search(cursor, user,
-                            [
-                                ('rec_name', domain[i][1], domain[i][2]),
-                            ], order=[], context=context)]
-                    elif isinstance(domain[i][2], (int, long)) \
-                            and not isinstance(domain[i][2], bool):
-                        res_ids = [domain[i][2]]
-                    else:
-                        res_ids = domain[i][2]
-                    if res_ids == True or res_ids == False:
+                    if isinstance(domain[i][2], bool):
                         relation_obj = self.pool.get(field.relation_name)
                         query1 = 'SELECT "' + field.origin + '" ' \
                                 'FROM "' + relation_obj._table + '" '\
                                 'WHERE "' + field.origin + '" IS NOT NULL'
                         query2 = []
                         clause = 'inselect'
-                        if res_ids == False:
+                        if domain[i][2] == False:
                             clause = 'notinselect'
                         domain[i] = ('id', clause, (query1, query2))
-                    elif not res_ids:
-                        domain[i] = ('id', '=', '0')
                     else:
+                        if isinstance(domain[i][2], basestring):
+                            target_field = 'rec_name'
+                        else:
+                            target_field = 'id'
                         relation_obj = self.pool.get(field.relation_name)
-                        red_sql, red_ids = reduce_ids('"' + field.target + '"',
-                                res_ids)
-                        query1 = 'SELECT "' + field.origin + '" ' \
-                                'FROM "' + relation_obj._table + '" ' \
-                                'WHERE ' + red_sql
-                        query2 = red_ids
+
+                        query1, query2 = target_obj.search(cursor, user, [
+                                    (target_field, domain[i][1], domain[i][2]),
+                                    ], order=[], query_string=True,
+                                    context=context)
+                        query1 = ('SELECT "%s" FROM "%s" WHERE "%s" IN (%s)' %
+                                (field.origin, relation_obj._table,
+                                    field.target, query1))
                         domain[i] = ('id', 'inselect', (query1, query2))
                 i += 1
 
diff --git a/trytond/report/report.py b/trytond/report/report.py
index 773d76a..7614fbf 100644
--- a/trytond/report/report.py
+++ b/trytond/report/report.py
@@ -191,7 +191,8 @@ class Report(object):
                 if file.startswith('Pictures'):
                     picture = style2_z.read(file)
                     pictures.append((file, picture))
-                    manifest.add_file_entry(file)
+                    if manifest:
+                        manifest.add_file_entry(file)
             style2_z.close()
             style2_io.close()
             dom_style2 = xml.dom.minidom.parseString(style2_xml)
diff --git a/trytond/version.py b/trytond/version.py
index 524015e..7f600bb 100644
--- a/trytond/version.py
+++ b/trytond/version.py
@@ -1,7 +1,7 @@
 #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 = "1.6.1"
+VERSION = "1.6.2"
 LICENSE = "GPL-3"
 WEBSITE = "http://www.tryton.org/"
 
-- 
tryton-server



More information about the tryton-debian-vcs mailing list