[tryton-debian-vcs] tryton-server branch upstream-4.2 updated. upstream/4.2.6-1-g26fd2c7

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Sun Nov 12 16:37:37 UTC 2017


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

commit 26fd2c73f5d00c4d850dfddb019f66635493a22f
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sat Nov 11 14:58:46 2017 +0100

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

diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..c4fd423
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,9 @@
+image: python:all
+env:
+  - POSTGRESQL_URI=postgresql://postgres@127.0.0.1:5432/
+  - MYSQL_URI=mysql://root@127.0.0.1:3306/
+script:
+  - pip install tox
+  - tox -e "{py27,py33,py34,py35}-{sqlite,postgresql}" --skip-missing-interpreters
+services:
+  - postgres
diff --git a/CHANGELOG b/CHANGELOG
index d606b4f..4ba747b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.2.7 - 2017-11-07
+* Bug fixes (see mercurial logs for details)
+
 Version 4.2.6 - 2017-08-08
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index f810386..4a253c5 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 4.2.6
+Version: 4.2.7
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..4dabc67
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,19 @@
+[tox]
+envlist = {py27,py33,py34,py35}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
+
+[testenv]
+commands = {envpython} setup.py test
+deps =
+    mock
+    {py27,py33,py34,py35}-postgresql: psycopg2 >= 2.5
+    pypy-postgresql: psycopg2cffi >= 2.5
+    mysql: MySQL-python
+    sqlite: sqlitebck
+setenv =
+    sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
+    postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
+    mysql: TRYTOND_DATABASE_URI={env:MYSQL_URI:mysql://}
+    sqlite: DB_NAME={env:SQLITE_NAME::memory:}
+    postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
+    mysql: DB_NAME={env:MYSQL_NAME:test}
+install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages}
diff --git a/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index f810386..4a253c5 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.2.6
+Version: 4.2.7
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond.egg-info/SOURCES.txt b/trytond.egg-info/SOURCES.txt
index 0882628..ccccbb7 100644
--- a/trytond.egg-info/SOURCES.txt
+++ b/trytond.egg-info/SOURCES.txt
@@ -1,3 +1,5 @@
+.drone.yml
+.hgtags
 CHANGELOG
 COPYRIGHT
 INSTALL
@@ -5,6 +7,7 @@ LICENSE
 MANIFEST.in
 README
 setup.py
+tox.ini
 bin/trytond
 bin/trytond-admin
 bin/trytond-cron
@@ -68,6 +71,7 @@ trytond/security.py
 trytond/sendmail.py
 trytond/test_loader.py
 trytond/transaction.py
+trytond/tryton.rnc
 trytond/url.py
 trytond/wsgi.py
 trytond.egg-info/PKG-INFO
diff --git a/trytond/__init__.py b/trytond/__init__.py
index 808be72..ba1b52e 100644
--- a/trytond/__init__.py
+++ b/trytond/__init__.py
@@ -5,7 +5,7 @@ import time
 import logging
 from email import charset
 
-__version__ = "4.2.6"
+__version__ = "4.2.7"
 logger = logging.getLogger(__name__)
 
 os.environ['TZ'] = 'UTC'
diff --git a/trytond/ir/action.py b/trytond/ir/action.py
index c17045b..9c2d00e 100644
--- a/trytond/ir/action.py
+++ b/trytond/ir/action.py
@@ -136,7 +136,7 @@ class ActionKeyword(ModelSQL, ModelView):
 
     @classmethod
     def search_groups(cls, name, clause):
-        return [('action.groups',) + tuple(clause[1:])]
+        return [('action.' + clause[0],) + tuple(clause[1:])]
 
     @classmethod
     def validate(cls, actions):
@@ -293,7 +293,7 @@ class ActionMixin(ModelSQL):
 
     @classmethod
     def search_action(cls, name, clause):
-        return [('action.' + name,) + tuple(clause[1:])]
+        return [('action.' + clause[0],) + tuple(clause[1:])]
 
     @classmethod
     def create(cls, vlist):
diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py
index 5c5aa55..a667b49 100644
--- a/trytond/ir/translation.py
+++ b/trytond/ir/translation.py
@@ -692,33 +692,10 @@ class Translation(ModelSQL, ModelView):
         ModelView._fields_view_get_cache.clear()
         vlist = [x.copy() for x in vlist]
 
-        cursor = Transaction().connection.cursor()
-        table = cls.__table__()
         for vals in vlist:
             if not vals.get('module'):
                 if Transaction().context.get('module'):
                     vals['module'] = Transaction().context['module']
-                elif vals.get('type', '') in {
-                        'report', 'view', 'wizard_button', 'selection',
-                        'error'}:
-                    cursor.execute(*table.select(table.module,
-                            where=(table.name == vals.get('name') or '')
-                            & (table.res_id == vals.get('res_id') or -1)
-                            & (table.lang == 'en')
-                            & (table.type == vals.get('type') or '')
-                            & (table.src == vals.get('src') or '')))
-                    fetchone = cursor.fetchone()
-                    if fetchone:
-                        vals['module'] = fetchone[0]
-                else:
-                    cursor.execute(*table.select(table.module, table.src,
-                            where=(table.name == vals.get('name') or '')
-                            & (table.res_id == vals.get('res_id') or -1)
-                            & (table.lang == 'en')
-                            & (table.type == vals.get('type') or '')))
-                    fetchone = cursor.fetchone()
-                    if fetchone:
-                        vals['module'], vals['src'] = fetchone
             vals['src_md5'] = cls.get_src_md5(vals.get('src'))
         return super(Translation, cls).create(vlist)
 
diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py
index 9a5fd5d..01d0969 100644
--- a/trytond/model/modelstorage.py
+++ b/trytond/model/modelstorage.py
@@ -270,10 +270,16 @@ class ModelStorage(Model):
             if 'state' in cls._defaults:
                 default['state'] = cls._defaults['state']()
 
+        def is_readonly(Model):
+            return (not issubclass(Model, ModelStorage)
+                or (hasattr(Model, 'table_query')
+                    and Model.table_query()))
+
         def convert_data(field_defs, data):
             data = data.copy()
             for field_name in field_defs:
                 ftype = field_defs[field_name]['type']
+                field = cls._fields[field_name]
 
                 if field_name in (
                         'create_date',
@@ -285,9 +291,8 @@ class ModelStorage(Model):
 
                 if field_name in default:
                     data[field_name] = default[field_name]
-                elif (isinstance(cls._fields[field_name], fields.Function)
-                        and not isinstance(cls._fields[field_name],
-                            fields.Property)):
+                elif (isinstance(field, fields.Function)
+                        and not isinstance(field, fields.Property)):
                     del data[field_name]
                 elif ftype in ('many2one', 'one2one'):
                     try:
@@ -296,10 +301,14 @@ class ModelStorage(Model):
                     except Exception:
                         pass
                 elif ftype in ('one2many',):
-                    if data[field_name]:
+                    if is_readonly(field.get_target()):
+                        del data[field_name]
+                    elif data[field_name]:
                         data[field_name] = [('copy', data[field_name])]
                 elif ftype == 'many2many':
-                    if data[field_name]:
+                    if is_readonly(pool.get(field.relation_name)):
+                        del data[field_name]
+                    elif data[field_name]:
                         data[field_name] = [('add', data[field_name])]
             if 'id' in data:
                 del data['id']
@@ -991,12 +1000,16 @@ class ModelStorage(Model):
 
                 validate_domain(field)
 
-                def required_test(value, field_name):
+                def required_test(value, field_name, field):
                     if (isinstance(value, (type(None), type(False), list,
                                     tuple, basestring, dict))
                             and not value):
                         cls.raise_user_error('required_validation_record',
                             error_args=cls._get_error_args(field_name))
+                    if (field._type == 'reference'
+                            and not isinstance(value, ModelStorage)):
+                        cls.raise_user_error('required_validation_record',
+                            error_args=cls._get_error_args(field_name))
                 # validate states required
                 if field.states and 'required' in field.states:
                     if is_pyson(field.states['required']):
@@ -1012,16 +1025,17 @@ class ModelStorage(Model):
                             required = PYSONDecoder(env).decode(pyson_required)
                             if required:
                                 required_test(getattr(record, field_name),
-                                    field_name)
+                                    field_name, field)
                     else:
                         if field.states['required']:
                             for record in records:
                                 required_test(getattr(record, field_name),
-                                    field_name)
+                                    field_name, field)
                 # validate required
                 if field.required:
                     for record in records:
-                        required_test(getattr(record, field_name), field_name)
+                        required_test(
+                            getattr(record, field_name), field_name, field)
                 # validate size
                 if hasattr(field, 'size') and field.size is not None:
                     for record in records:
diff --git a/trytond/tryton.rnc b/trytond/tryton.rnc
new file mode 100644
index 0000000..fe87698
--- /dev/null
+++ b/trytond/tryton.rnc
@@ -0,0 +1,32 @@
+namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
+
+tryton = element tryton { attlist.tryton, data* }
+attlist.tryton &= empty
+data = element data { attlist.data, (record | menuitem)* }
+attlist.data &=
+  [ a:defaultValue = "0" ] attribute noupdate { "0" | "1" }?
+attlist.data &=
+  [ a:defaultValue = "0" ] attribute grouped { "0" | "1" }?
+attlist.data &= attribute depends { text }
+record = element record { attlist.record, field* }
+attlist.record &= attribute model { text }
+attlist.record &= attribute id { text }
+attlist.record &=
+  [ a:defaultValue = "0" ] attribute update { "0" | "1" }?
+field = element field { attlist.field, text }
+attlist.field &= attribute name { text }
+attlist.field &= attribute search { text }?
+attlist.field &= attribute ref { text }?
+attlist.field &= attribute eval { text }?
+attlist.field &= attribute pyson { "0" | "1" }?
+attlist.field &= attribute type { "xml" }?
+menuitem = element menuitem { attlist.menuitem, empty }
+attlist.menuitem &= attribute id { text }
+attlist.menuitem &= attribute name { text }?
+attlist.menuitem &= attribute icon { text }?
+attlist.menuitem &= attribute sequence { text }?
+attlist.menuitem &= attribute parent { text }?
+attlist.menuitem &= attribute action { text }?
+attlist.menuitem &= attribute groups { text }?
+attlist.menuitem &= attribute active { text }?
+start = tryton
-- 
tryton-server



More information about the tryton-debian-vcs mailing list