From 4fbfdaf2048df3cc33ad213a7f2c08c5513523bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 21 Oct 2013 17:33:17 +0200 Subject: [PATCH 01/16] Increase version number --- trytond/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/version.py b/trytond/version.py index 7f33a34b0e..95e95bca75 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.0" +VERSION = "3.0.1" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From 43db05a8f5f891dec4b4978cdfe42219b81e62f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 27 Oct 2013 19:27:19 +0100 Subject: [PATCH 02/16] User.get_preferences must return a copy preferences is stored in the cache but as it is a mutable object, we must return a copy to prevent cache corruption. issue3442 review1351002 (transplanted from de55086332d1f9f65b920c50c3692a6ee93216ed) --- trytond/res/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/res/user.py b/trytond/res/user.py index 2cd6e6dc74..e50c8fd9db 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -342,13 +342,13 @@ class User(ModelSQL, ModelView): key = (Transaction().user, context_only) preferences = cls._get_preferences_cache.get(key) if preferences is not None: - return preferences + return preferences.copy() user = Transaction().user with Transaction().set_user(0): user = cls(user) preferences = cls._get_preferences(user, context_only=context_only) cls._get_preferences_cache.set(key, preferences) - return preferences + return preferences.copy() @classmethod def set_preferences(cls, values, old_password=False): From 70011c537b2f6affd7333fd4ae66c52cdee6f0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 5 Nov 2013 17:20:08 +0100 Subject: [PATCH 03/16] Fix history search to remove only past deleted records review1481002 (transplanted from d3d7bfc0e0d674bd77add27f28bf0479ed005f0d) --- trytond/model/modelsql.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index b3fbcfab5c..3f81ca8abb 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -994,7 +994,9 @@ class ModelSQL(ModelStorage): cursor.execute(*history.select(history.id, history.write_date, where=where & (history.write_date != None) - & (history.create_date == None))) + & (history.create_date == None) + & (history.write_date + <= transaction.context['_datetime']))) for deleted_id, delete_date in cursor.fetchall(): if ids_date[deleted_id] < delete_date: to_delete.add(deleted_id) From 0a22f370893011378c0e5df2abf692fda97b257b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 4 Dec 2013 16:55:44 +0100 Subject: [PATCH 04/16] Prepare release 3.0.1 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index ae9f454cbb..8ab927200b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 3.0.1 - 2013-12-04 +* Bug fixes (see mercurial logs for details) + Version 3.0.0 - 2013-10-21 * Bug fixes (see mercurial logs for details) * Allow customization of translation in po files From eefa93f86219b9cdbdb47b133b71b8c1fbd56431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 4 Dec 2013 16:55:45 +0100 Subject: [PATCH 05/16] Added tag 3.0.1 for changeset 09a90d0347ff --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 7c40a82486..4caf364cfc 100644 --- a/.hgtags +++ b/.hgtags @@ -9,3 +9,4 @@ af3a6063b46bf8739a513a06400fbb9858b5869b 1.8.0 36530840a1d0dce354bbaa58ec849a409d306d83 2.6.0 2893d6c3efd6df3759ab09a28ea16773a160118e 2.8.0 759c6ff44b90b8c685e9d9a4124bcd85af204649 3.0.0 +09a90d0347ffed8599970ea91635f94aee4a14c0 3.0.1 From 4b3860c2ce49dbe6133fcd0597d81244b61448b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 4 Dec 2013 16:56:11 +0100 Subject: [PATCH 06/16] Increase version number --- trytond/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/version.py b/trytond/version.py index 95e95bca75..37aca7a3ab 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.1" +VERSION = "3.0.2" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From 4f742afee7e07f2bec9e10c1e08418085257d745 Mon Sep 17 00:00:00 2001 From: resteve Date: Wed, 27 Nov 2013 09:04:34 +0100 Subject: [PATCH 07/16] Set missing charset to MIME message on cron error issue3522 review1951002 (transplanted from 3fb81bb57a08f38d7889ace13a621ee5ba022838) --- trytond/ir/cron.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trytond/ir/cron.py b/trytond/ir/cron.py index 3255b82718..904a2fd78b 100644 --- a/trytond/ir/cron.py +++ b/trytond/ir/cron.py @@ -7,6 +7,7 @@ import traceback import sys import logging from email.mime.text import MIMEText +from email.header import Header from ..model import ModelView, ModelSQL, fields from ..tools import safe_eval, get_smtp_server @@ -135,10 +136,10 @@ class Cron(ModelSQL, ModelView): from_addr = CONFIG['smtp_default_from_email'] to_addr = cron.request_user.email - msg = MIMEText(body) + msg = MIMEText(body, _charset='utf-8') msg['To'] = to_addr msg['From'] = from_addr - msg['Subject'] = subject + msg['Subject'] = Header(subject, 'utf-8') logger = logging.getLogger(__name__) if not to_addr: logger.error(msg.as_string()) From 4eb89ffb6d895d562f47611b5e3d551be8dd9c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 28 Nov 2013 23:07:46 +0100 Subject: [PATCH 08/16] Fix RPC.convert usage to return a copy of args and kwargs issue3521 review1921002 (transplanted from 2d0b71f9df953047e875ddbd510804474126fad9) --- trytond/protocols/dispatcher.py | 12 ++++++------ trytond/rpc.py | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/trytond/protocols/dispatcher.py b/trytond/protocols/dispatcher.py index 61bd7dadc0..3fdc5016ab 100644 --- a/trytond/protocols/dispatcher.py +++ b/trytond/protocols/dispatcher.py @@ -161,18 +161,18 @@ def dispatch(host, port, protocol, database_name, user, session, object_type, with Transaction().start(database_name, user, readonly=rpc.readonly) as transaction: try: - args, kwargs, transaction.context, transaction.timestamp = \ - rpc.convert(obj, *args, **kwargs) + c_args, c_kwargs, transaction.context, transaction.timestamp \ + = rpc.convert(obj, *args, **kwargs) meth = getattr(obj, method) if not hasattr(meth, 'im_self') or meth.im_self: - result = rpc.result(meth(*args, **kwargs)) + result = rpc.result(meth(*c_args, **c_kwargs)) else: assert rpc.instantiate == 0 - inst = args.pop(0) + inst = c_args.pop(0) if hasattr(inst, method): - result = rpc.result(meth(inst, *args, **kwargs)) + result = rpc.result(meth(inst, *c_args, **c_kwargs)) else: - result = [rpc.result(meth(i, *args, **kwargs)) + result = [rpc.result(meth(i, *c_args, **c_kwargs)) for i in inst] if not rpc.readonly: transaction.cursor.commit() diff --git a/trytond/rpc.py b/trytond/rpc.py index b9eed3a2d4..afa0827c92 100644 --- a/trytond/rpc.py +++ b/trytond/rpc.py @@ -23,6 +23,7 @@ class RPC(object): def convert(self, obj, *args, **kwargs): args = list(args) + kwargs = kwargs.copy() if 'context' in kwargs: context = kwargs.pop('context') else: From 6892d9452007339dd8a6faf7fe0ab62ed6365135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 6 Dec 2013 11:28:48 +0100 Subject: [PATCH 09/16] Database.list must set manually the flavor issue3508 review2121002 (transplanted from f18cb8a2ee0c1c826db4259ea4162bb285ef963e) --- trytond/protocols/dispatcher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trytond/protocols/dispatcher.py b/trytond/protocols/dispatcher.py index 3fdc5016ab..81e8dfcbaf 100644 --- a/trytond/protocols/dispatcher.py +++ b/trytond/protocols/dispatcher.py @@ -7,7 +7,7 @@ import time import sys import pydoc -from sql import Table +from sql import Table, Flavor from trytond.pool import Pool from trytond import security @@ -86,6 +86,7 @@ def dispatch(host, port, protocol, database_name, user, session, object_type, if CONFIG['prevent_dblist']: raise Exception('AccessDenied') database = Database().connect() + Flavor.set(Database.flavor) try: cursor = database.cursor() try: From b1684b03c9a69d9c9614af0638932ec14b04dedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 18 Jan 2014 20:35:05 +0100 Subject: [PATCH 10/16] Prepare release 3.0.2 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 8ab927200b..827c7dbf74 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 3.0.2 - 2014-01-18 +* Bug fixes (see mercurial logs for details) + Version 3.0.1 - 2013-12-04 * Bug fixes (see mercurial logs for details) From 2133e8734cb00a930fca79e4a88716b25f282a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 18 Jan 2014 20:35:07 +0100 Subject: [PATCH 11/16] Added tag 3.0.2 for changeset 461ea1d6999a --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 4caf364cfc..21fbb836c4 100644 --- a/.hgtags +++ b/.hgtags @@ -10,3 +10,4 @@ af3a6063b46bf8739a513a06400fbb9858b5869b 1.8.0 2893d6c3efd6df3759ab09a28ea16773a160118e 2.8.0 759c6ff44b90b8c685e9d9a4124bcd85af204649 3.0.0 09a90d0347ffed8599970ea91635f94aee4a14c0 3.0.1 +461ea1d6999a4089bf32b97d0d8582df66b43f0d 3.0.2 From 55ec15417f04fd0331778d430a019a9e55386848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 18 Jan 2014 20:35:38 +0100 Subject: [PATCH 12/16] Increase version number --- trytond/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/version.py b/trytond/version.py index 37aca7a3ab..08eb75ca84 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.2" +VERSION = "3.0.3" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From e293c3f0e322005c90c956667a1095bafffdab7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 23 Dec 2013 00:34:25 +0100 Subject: [PATCH 13/16] Fix default_state of test workflow staticmethod doesn't take cls as parameter (transplanted from 4cf2e96a673a5fa83be08c3a1743e70a95112e69) --- trytond/tests/workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/tests/workflow.py b/trytond/tests/workflow.py index be4344500c..2724b8afab 100644 --- a/trytond/tests/workflow.py +++ b/trytond/tests/workflow.py @@ -25,7 +25,7 @@ class WorkflowedModel(Workflow, ModelSQL): )) @staticmethod - def default_state(cls): + def default_state(): return 'start' @classmethod From 0cf9e9edffd53a1faa5e6e6d2d41079e8cff4e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 23 Dec 2013 20:22:52 +0100 Subject: [PATCH 14/16] Fix _rebuild_tree to take in account inactive records issue3509 review2401002 (transplanted from 597e24b340dad896a2cec148d367c4ee3bfdb6e8) --- trytond/model/modelsql.py | 10 +++++----- trytond/tests/test_mptt.py | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index 3f81ca8abb..798a893216 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -1083,12 +1083,12 @@ class ModelSQL(ModelStorage): table = cls.__table__() right = left + 1 - childs = cls.search([ - (parent, '=', parent_id), - ], order=[]) + cursor.execute(*table.select(table.id, + where=Column(table, parent) == parent_id)) + childs = cursor.fetchall() - for child in childs: - right = cls._rebuild_tree(parent, child.id, right) + for child_id, in childs: + right = cls._rebuild_tree(parent, child_id, right) field = cls._fields[parent] diff --git a/trytond/tests/test_mptt.py b/trytond/tests/test_mptt.py index faff5a3f8e..5b5fd49061 100644 --- a/trytond/tests/test_mptt.py +++ b/trytond/tests/test_mptt.py @@ -19,9 +19,10 @@ class MPTTTestCase(unittest.TestCase): self.mptt = POOL.get('test.mptt') def CheckTree(self, parent_id=None, left=-1, right=sys.maxint): - childs = self.mptt.search([ - ('parent', '=', parent_id), - ], order=[('left', 'ASC')]) + with Transaction().set_context(active_test=False): + childs = self.mptt.search([ + ('parent', '=', parent_id), + ], order=[('left', 'ASC')]) for child in childs: assert child.left > left, \ '%s: left %d <= parent left %d' % \ @@ -109,6 +110,16 @@ class MPTTTestCase(unittest.TestCase): transaction.cursor.rollback() + with Transaction().start(DB_NAME, USER, + context=CONTEXT) as transaction: + records = self.mptt.search([]) + self.mptt.write(records[::2], { + 'active': False + }) + self.CheckTree() + + transaction.cursor.rollback() + with Transaction().start(DB_NAME, USER, context=CONTEXT) as transaction: records = self.mptt.search([]) From cc74f29d9c15aa709ae6d4f67e3a463a12850059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 31 Jan 2014 22:29:01 +0100 Subject: [PATCH 15/16] Fix documentation about button name review3011004 (transplanted from 97ae3a1a8a01e1272b91bc0457f3d71bbc9f057c) --- doc/topics/views/index.rst | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/doc/topics/views/index.rst b/doc/topics/views/index.rst index 1b1ff009bb..bf9da749b7 100644 --- a/doc/topics/views/index.rst +++ b/doc/topics/views/index.rst @@ -303,14 +303,10 @@ Display a button. * ``string``: The string that will be displayed inside the button. - * ``name``: The name of the action: + * ``name``: The name of the function that will be called. The function must + have this syntax: - * ``object``: the name of the function that will called. The function - must have this syntax: - - ``button(self, ids)`` - - * ``action``: the id of the ir.action that will be called. + ``button(cls, records)`` * ``icon`` From 26abe9ecd18e74f250a97b3446eb15e66fe53ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 9 Feb 2014 23:53:10 +0100 Subject: [PATCH 16/16] Search also on source for some translation types when overriding issue3637 review3221004 (transplanted from 6721c1f1bc0cddbdc6707b4c9803c6d56f6b459d) --- trytond/ir/translation.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py index 3f13f68554..e6a3f57257 100644 --- a/trytond/ir/translation.py +++ b/trytond/ir/translation.py @@ -791,7 +791,7 @@ class Translation(ModelSQL, ModelView): if len(module_translations) <= RECORD_CACHE_SIZE: id2translation[translation.id] = translation - def override_translation(ressource_id, new_translation, fuzzy): + def override_translation(ressource_id, new_translation, src, fuzzy): res_id_module, res_id = ressource_id.split('.') if res_id: model_data, = ModelData.search([ @@ -803,13 +803,17 @@ class Translation(ModelSQL, ModelView): res_id = -1 with contextlib.nested(Transaction().set_user(0), Transaction().set_context(module=res_id_module)): - translation, = cls.search([ - ('name', '=', name), - ('res_id', '=', res_id), - ('lang', '=', lang), - ('type', '=', ttype), - ('module', '=', res_id_module), - ]) + domain = [ + ('name', '=', name), + ('res_id', '=', res_id), + ('lang', '=', lang), + ('type', '=', ttype), + ('module', '=', res_id_module), + ] + if ttype in ('odt', 'view', 'wizard_button', 'selection', + 'error'): + domain.append(('src', '=', src)) + translation, = cls.search(domain) if translation.value != new_translation: translation.value = new_translation translation.overriding_module = module @@ -835,7 +839,7 @@ class Translation(ModelSQL, ModelView): noupdate = False if '.' in res_id: - override_translation(res_id, value, fuzzy) + override_translation(res_id, value, ttype, fuzzy) continue model = name.split(',')[0]