Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package trytond for openSUSE:Factory checked in at 2021-04-12 12:37:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/trytond (Old) and /work/SRC/openSUSE:Factory/.trytond.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "trytond" Mon Apr 12 12:37:24 2021 rev:58 rq:884502 version:5.0.34 Changes: -------- --- /work/SRC/openSUSE:Factory/trytond/trytond.changes 2021-03-02 12:44:57.612329765 +0100 +++ /work/SRC/openSUSE:Factory/.trytond.new.2401/trytond.changes 2021-04-12 12:40:17.625573582 +0200 @@ -1,0 +2,5 @@ +Sun Apr 4 17:41:09 UTC 2021 - Axel Braun <axel.br...@gmx.de> + +- Version 5.0.34 - Bugfix Release + +------------------------------------------------------------------- Old: ---- trytond-5.0.33.tar.gz trytond-5.0.33.tar.gz.asc New: ---- trytond-5.0.34.tar.gz trytond-5.0.34.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ trytond.spec ++++++ --- /var/tmp/diff_new_pack.ap4lKU/_old 2021-04-12 12:40:18.553574661 +0200 +++ /var/tmp/diff_new_pack.ap4lKU/_new 2021-04-12 12:40:18.557574666 +0200 @@ -20,7 +20,7 @@ %define majorver 5.0 %define base_name tryton Name: trytond -Version: %{majorver}.33 +Version: %{majorver}.34 Release: 0 Summary: An Enterprise Resource Planning (ERP) system License: GPL-3.0-or-later ++++++ trytond-5.0.33.tar.gz -> trytond-5.0.34.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/.hgtags new/trytond-5.0.34/.hgtags --- old/trytond-5.0.33/.hgtags 2021-02-12 10:14:44.000000000 +0100 +++ new/trytond-5.0.34/.hgtags 2021-04-02 21:53:28.000000000 +0200 @@ -52,3 +52,4 @@ bc3e5508144ab909a7980010ce21f9cc17be29f7 5.0.31 c485f522f9aa8c544e0857795c540c1b95c0407e 5.0.32 268cdae7d36eb3730bc9b722518fa26bd778cdf3 5.0.33 +91c52f70ccb84ffdd122b29888828a74aac04a83 5.0.34 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/CHANGELOG new/trytond-5.0.34/CHANGELOG --- old/trytond-5.0.33/CHANGELOG 2021-02-12 10:14:44.000000000 +0100 +++ new/trytond-5.0.34/CHANGELOG 2021-04-02 21:53:27.000000000 +0200 @@ -1,3 +1,6 @@ +Version 5.0.34 - 2021-04-02 +* Bug fixes (see mercurial logs for details) + Version 5.0.33 - 2021-02-12 * Bug fixes (see mercurial logs for details) * Use safe_join in SharedDataMiddlewareIndex (issue10068) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/PKG-INFO new/trytond-5.0.34/PKG-INFO --- old/trytond-5.0.33/PKG-INFO 2021-02-12 10:14:46.511693200 +0100 +++ new/trytond-5.0.34/PKG-INFO 2021-04-02 21:53:30.106638700 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: trytond -Version: 5.0.33 +Version: 5.0.34 Summary: Tryton server Home-page: http://www.tryton.org/ Author: Tryton diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/trytond/__init__.py new/trytond-5.0.34/trytond/__init__.py --- old/trytond-5.0.33/trytond/__init__.py 2021-02-01 22:51:13.000000000 +0100 +++ new/trytond-5.0.34/trytond/__init__.py 2021-02-12 10:14:59.000000000 +0100 @@ -5,7 +5,7 @@ import warnings from email import charset -__version__ = "5.0.33" +__version__ = "5.0.34" os.environ['TZ'] = 'UTC' if hasattr(time, 'tzset'): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/trytond/cache.py new/trytond-5.0.34/trytond/cache.py --- old/trytond-5.0.33/trytond/cache.py 2019-08-11 19:34:43.000000000 +0200 +++ new/trytond-5.0.34/trytond/cache.py 2021-03-16 00:44:19.000000000 +0100 @@ -35,7 +35,9 @@ def _key(self, key): if self.context: - return (key, Transaction().user, freeze(Transaction().context)) + context = Transaction().context + context.pop('client', None) + return (key, Transaction().user, freeze(context)) return key def get(self, key, default=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/trytond/ir/translation.py new/trytond-5.0.34/trytond/ir/translation.py --- old/trytond-5.0.33/trytond/ir/translation.py 2019-08-11 19:34:43.000000000 +0200 +++ new/trytond-5.0.34/trytond/ir/translation.py 2021-03-16 09:36:44.000000000 +0100 @@ -3,6 +3,7 @@ import os import xml.dom.minidom from difflib import SequenceMatcher +from collections import defaultdict from hashlib import md5 from io import BytesIO from lxml import etree @@ -485,30 +486,32 @@ return record.model + ',' + field_name with Transaction().set_context(_check_access=False): - translations = {} + name2translations = defaultdict(list) for translation in cls.search([ ('lang', '=', lang), ('type', '=', ttype), ('name', 'in', [get_name(r) for r in records]), ]): - translations[translation.name] = translation + name2translations[translation.name].append(translation) to_save = [] for record, value in zip(records, values): - translation = translations.get(get_name(record)) + translations = name2translations.get(get_name(record)) if lang == 'en': src = value else: src = getattr(record, field_name) - if not translation: + if not translations: translation = cls() translation.name = name translation.lang = lang translation.type = ttype - translation.src = src - translation.value = value - translation.fuzzy = False - to_save.append(translation) + translations.append(translation) + for translation in translations: + translation.src = src + translation.value = value + translation.fuzzy = False + to_save.append(translation) cls.save(to_save) return @@ -516,7 +519,8 @@ with Transaction().set_context(language=Config.get_language()): records = Model.browse(ids) - translations = {} + id2translations = defaultdict(list) + other_translations = defaultdict(list) with Transaction().set_context(_check_access=False): for translation in cls.search([ ('lang', '=', lang), @@ -524,9 +528,8 @@ ('name', '=', name), ('res_id', 'in', ids), ]): - translations[translation.res_id] = translation + id2translations[translation.res_id].append(translation) - other_translations = {} if (lang == Config.get_language() and Transaction().context.get('fuzzy_translation', True)): for translation in cls.search([ @@ -535,33 +538,34 @@ ('name', '=', name), ('res_id', 'in', ids), ]): - other_translations.setdefault(translation.res_id, [] - ).append(translation) + other_translations[translation.res_id].append(translation) to_save = [] for record, value in zip(records, values): - translation = translations.get(record.id) + translations = id2translations[record.id] if lang == Config.get_language(): src = value else: src = getattr(record, field_name) - if not translation: + if not translations: translation = cls() translation.name = name translation.lang = lang translation.type = ttype translation.res_id = record.id + translations.append(translation) else: - other_langs = other_translations.get(record.id) + other_langs = other_translations[record.id] if other_langs: for other_lang in other_langs: other_lang.src = src other_lang.fuzzy = True to_save.append(other_lang) - translation.value = value - translation.src = src - translation.fuzzy = False - to_save.append(translation) + for translation in translations: + translation.value = value + translation.src = src + translation.fuzzy = False + to_save.append(translation) cls.save(to_save) @classmethod diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/trytond/model/fields/field.py new/trytond-5.0.34/trytond/model/fields/field.py --- old/trytond-5.0.33/trytond/model/fields/field.py 2020-10-30 19:56:48.000000000 +0100 +++ new/trytond-5.0.34/trytond/model/fields/field.py 2021-03-16 00:44:19.000000000 +0100 @@ -3,8 +3,10 @@ import warnings from functools import wraps +import sql from sql import (operators, Column, Literal, Select, CombiningQuery, Null, Query, Expression, Cast) +from sql.aggregate import Min from sql.conditionals import Coalesce, NullIf from sql.operators import Concat @@ -19,6 +21,8 @@ Database = backend.get('Database') +_sql_version = tuple(map(int, sql.__version__.split('.'))) + def domain_validate(value): assert isinstance(value, list), 'domain must be a list' @@ -393,34 +397,40 @@ def _get_translation_join(self, Model, name, translation, model, table, from_, language): if Model.__name__ == 'ir.model': - return from_.join(translation, 'LEFT', - condition=(translation.name == Concat(Concat( - table.model, ','), name)) - & (translation.res_id == -1) - & (translation.lang == language) - & (translation.type == 'model') - & (translation.fuzzy == False)) + name_ = Concat(Concat(table.model, ','), name) + type_ = 'model' + res_id = -1 elif Model.__name__ == 'ir.model.field': + name_ = Concat(Concat(model.model, ','), table.name) if name == 'field_description': type_ = 'field' else: type_ = 'help' - return from_.join(model, 'LEFT', - condition=model.id == table.model).join( - translation, 'LEFT', - condition=(translation.name == Concat(Concat( - model.model, ','), table.name)) - & (translation.res_id == -1) - & (translation.lang == language) - & (translation.type == type_) - & (translation.fuzzy == False)) + res_id = -1 + else: + name_ = '%s,%s' % (Model.__name__, name) + type_ = 'model' + res_id = table.id + if backend.name() == 'postgresql' and _sql_version >= (1, 1, 0): + query = translation.select( + translation.res_id.as_('res_id'), + translation.value.as_('value'), + distinct=True, + distinct_on=[translation.res_id], + order_by=[translation.res_id, translation.id.desc]) else: - return from_.join(translation, 'LEFT', - condition=(translation.res_id == table.id) - & (translation.name == '%s,%s' % (Model.__name__, name)) - & (translation.lang == language) - & (translation.type == 'model') - & (translation.fuzzy == False)) + query = translation.select( + translation.res_id.as_('res_id'), + Min(translation.value).as_('value'), + group_by=[translation.res_id]) + query.where = ( + (translation.lang == language) + & (translation.type == type_) + & (translation.name == name_) + & (translation.fuzzy == Literal(False)) + ) + return query, from_.join(query, 'LEFT', + condition=(query.res_id == res_id)) def convert_domain(self, domain, tables, Model): from trytond.ir.lang import get_parent_language @@ -438,7 +448,7 @@ column = None while language: translation = Translation.__table__() - join = self._get_translation_join( + translation, join = self._get_translation_join( Model, name, translation, model, table, join, language) column = Coalesce(NullIf(column, ''), translation.value) language = get_parent_language(language) @@ -474,7 +484,7 @@ if key not in tables: translation = Translation.__table__() model = IrModel.__table__() - join = self._get_translation_join( + translation, join = self._get_translation_join( Model, name, translation, model, table, table, language) if join.left == table: tables[key] = { @@ -495,4 +505,4 @@ column = Coalesce(NullIf(column, ''), translation.value) language = get_parent_language(language) - return [Coalesce(column, self.sql_column(table))] + return [Coalesce(NullIf(column, ''), self.sql_column(table))] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/trytond/model/fields/selection.py new/trytond-5.0.34/trytond/model/fields/selection.py --- old/trytond-5.0.33/trytond/model/fields/selection.py 2019-08-11 19:34:43.000000000 +0200 +++ new/trytond-5.0.34/trytond/model/fields/selection.py 2021-03-16 00:44:19.000000000 +0100 @@ -111,7 +111,9 @@ # None and '' are equivalent if value is None or value == '': if value not in selection: - value = {None: '', '': None}[value] + switch_value = {None: '', '': None}[value] + if switch_value in selection: + value = switch_value # Use Model __name__ for Reference field elif isinstance(value, Model): value = value.__name__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/trytond-5.0.33/trytond.egg-info/PKG-INFO new/trytond-5.0.34/trytond.egg-info/PKG-INFO --- old/trytond-5.0.33/trytond.egg-info/PKG-INFO 2021-02-12 10:14:45.000000000 +0100 +++ new/trytond-5.0.34/trytond.egg-info/PKG-INFO 2021-04-02 21:53:29.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: trytond -Version: 5.0.33 +Version: 5.0.34 Summary: Tryton server Home-page: http://www.tryton.org/ Author: Tryton