From c9fa780500a456197d670efe7fc5b5a2d9e18942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 22 Oct 2012 22:56:44 +0200 Subject: [PATCH 01/85] 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 9efd8dc009..85373909f8 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 = "2.6.0" +VERSION = "2.6.1" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From 2253613775803492b0a04cf38a05c52e3c7d35a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 24 Oct 2012 23:36:47 +0200 Subject: [PATCH 02/85] Allow to use id instead of xml_id in ActWindow.get review579002 (transplanted from cdf9018dfb1d89cb980c72ba64d92dc97d7b3ad3) --- trytond/ir/action.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/trytond/ir/action.py b/trytond/ir/action.py index ec9025eb18..30eb92d124 100644 --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -734,11 +734,14 @@ class ActionActWindow(ModelSQL, ModelView): @classmethod def get(cls, xml_id): - 'Get values from XML id' + 'Get values from XML id or id' pool = Pool() ModelData = pool.get('ir.model.data') Action = pool.get('ir.action') - action_id = ModelData.get_id(*xml_id.split('.')) + if '.' in xml_id: + action_id = ModelData.get_id(*xml_id.split('.')) + else: + action_id = int(xml_id) return Action.get_action_values(cls.__name__, [action_id])[0] @classmethod From 0d2adf8ab02f57d242e2625caa4dd6ec40bd0cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 24 Oct 2012 23:38:12 +0200 Subject: [PATCH 03/85] Factorize load of module The test for register on module should be done also on egg modules. issue2853 review586002 (transplanted from 8b4d284d9c24dab2765b2b7f0179869c6ce45124) --- trytond/modules/__init__.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/trytond/modules/__init__.py b/trytond/modules/__init__.py index cb47cf3cb5..0df44940c5 100644 --- a/trytond/modules/__init__.py +++ b/trytond/modules/__init__.py @@ -338,15 +338,7 @@ def register_classes(): continue if os.path.isdir(OPJ(MODULES_PATH, module)): - mod_file, pathname, description = imp.find_module(module, - [MODULES_PATH]) - the_module = imp.load_module( - 'trytond.modules.' + module, mod_file, pathname, description) - # Some modules register nothing in the Pool - if hasattr(the_module, 'register'): - the_module.register() - if mod_file is not None: - mod_file.close() + mod_path = MODULES_PATH elif module in EGG_MODULES: ep = EGG_MODULES[module] mod_path = os.path.join(ep.dist.location, @@ -362,16 +354,17 @@ def register_classes(): # When testing modules from setuptools location is the # module directory mod_path = os.path.dirname(ep.dist.location) - mod_file, pathname, description = imp.find_module(module, - [mod_path]) - try: - imp.load_module('trytond.modules.' + module, mod_file, - pathname, description).register() - finally: - if mod_file is not None: - mod_file.close() else: raise Exception('Couldn\'t find module %s' % module) + mod_file, pathname, description = imp.find_module(module, + [mod_path]) + the_module = imp.load_module('trytond.modules.' + module, + mod_file, pathname, description) + # Some modules register nothing in the Pool + if hasattr(the_module, 'register'): + the_module.register() + if mod_file is not None: + mod_file.close() MODULES.append(module) From 625d26e941c25543f7deeff26202fa3160077b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 17:40:34 +0100 Subject: [PATCH 04/85] Prepare release 2.6.1 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 0ae4ff43e8..84391cdf8a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.1 - 2012-11-05 +* Bug fixes (see mercurial logs for details) + Version 2.6.0 - 2012-10-22 * Bug fixes (see mercurial logs for details) * Add pre-validation From eec85ecd157574463434ef0c8fa293b76a91bc2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 17:40:35 +0100 Subject: [PATCH 05/85] Added tag 2.6.1 for changeset 145684ebd2d8 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index ffc118c9b2..fb4c0712dc 100644 --- a/.hgtags +++ b/.hgtags @@ -7,3 +7,4 @@ af3a6063b46bf8739a513a06400fbb9858b5869b 1.8.0 1df3f0702c621e65279af52d1f87725747ae8fa4 2.2.0 640af4420c8eace7ee59a432bec54692f4808b20 2.4.0 36530840a1d0dce354bbaa58ec849a409d306d83 2.6.0 +145684ebd2d802461474139c336f993b74186de4 2.6.1 From b0842d68f2ace6282592b6a5173cfa43480822a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 17:41:08 +0100 Subject: [PATCH 06/85] 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 85373909f8..8d36f360e9 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 = "2.6.1" +VERSION = "2.6.2" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From bda0c5c98cbc2044bbaf3455d7b49e9cf86715b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 1 Nov 2012 13:53:04 +0100 Subject: [PATCH 07/85] Fix Menu.search_rec_name to use ids instead of instance (transplanted from d87509b1e60f031dadb8f17f31ea6c3be9f1355a) --- trytond/ir/ui/menu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/ir/ui/menu.py b/trytond/ir/ui/menu.py index 0a232cc882..c7ea2dda2c 100644 --- a/trytond/ir/ui/menu.py +++ b/trytond/ir/ui/menu.py @@ -143,7 +143,7 @@ class UIMenu(ModelSQL, ModelView): for name in values: domain.append((field, clause[1], name)) field = 'parent.' + field - ids = cls.search(domain, order=[]) + ids = [m.id for m in cls.search(domain, order=[])] return [('id', 'in', ids)] #TODO Handle list return [('name',) + tuple(clause[1:])] From f7b65654883fa9a8d6e7637851ac09cd921b7bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Tue, 13 Nov 2012 11:26:38 +0100 Subject: [PATCH 08/85] fix use of password not in ASCII review582004 issue2869 (transplanted from 11723f7a90274c0ede62bec51f782aa2efab0eea) --- trytond/protocols/dispatcher.py | 6 ++++-- trytond/security.py | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/trytond/protocols/dispatcher.py b/trytond/protocols/dispatcher.py index b2d1ecbe6b..41df078d89 100644 --- a/trytond/protocols/dispatcher.py +++ b/trytond/protocols/dispatcher.py @@ -237,9 +237,11 @@ def create(database_name, password, lang, admin_password): 'WHERE code = %s', 1) + ')' \ 'WHERE login <> \'root\'', (lang,)) if hashlib: - admin_password = hashlib.sha1(admin_password).hexdigest() + admin_password = hashlib.sha1(admin_password.encode('utf-8'))\ + .hexdigest() else: - admin_password = sha.new(admin_password).hexdigest() + admin_password = sha.new(admin_password.encode('utf-8'))\ + .hexdigest() cursor.execute('UPDATE res_user ' \ 'SET password = %s ' \ 'WHERE login = \'admin\'', (admin_password,)) diff --git a/trytond/security.py b/trytond/security.py index e50d9f871c..14729bcbce 100644 --- a/trytond/security.py +++ b/trytond/security.py @@ -18,7 +18,6 @@ def login(dbname, loginname, password, cache=True): with Transaction().start(dbname, 0) as transaction: pool = _get_pool(dbname) User = pool.get('res.user') - password = password.decode('utf-8') user_id = User.get_login(loginname, password) transaction.cursor.commit() if user_id: From 8526975a4124375ab09ae782c058266a8a1f4db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 20 Nov 2012 22:15:32 +0100 Subject: [PATCH 09/85] Remove duplicate ShowView in __all__ (transplanted from e5b0c242b654e7eabcfa61e536926168a4b602d5) --- trytond/ir/ui/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/ir/ui/view.py b/trytond/ir/ui/view.py index cf5d77b4ea..9047a6e876 100644 --- a/trytond/ir/ui/view.py +++ b/trytond/ir/ui/view.py @@ -15,7 +15,7 @@ from trytond.cache import Cache from trytond.rpc import RPC __all__ = [ - 'View', 'ShowViewStart', 'ShowView', 'ViewShortcut', 'ShowView', + 'View', 'ShowViewStart', 'ShowView', 'ViewShortcut', 'OpenShortcut', 'ViewTreeWidth', 'ViewTreeExpandedState', ] From 0ef455cbedaae47a95b74f76f05e50660cdf7389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Nov 2012 22:32:20 +0100 Subject: [PATCH 10/85] Restore size limit of the Translation cache (transplanted from d31dc05eba28d0a7933b869b1006a2e4e3805034) --- trytond/ir/translation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py index f62c947fef..f472296823 100644 --- a/trytond/ir/translation.py +++ b/trytond/ir/translation.py @@ -69,7 +69,8 @@ class Translation(ModelSQL, ModelView): fuzzy = fields.Boolean('Fuzzy') model = fields.Function(fields.Char('Model'), 'get_model', searcher='search_model') - _translation_cache = Cache('ir.translation') + _translation_cache = Cache('ir.translation', size_limit=10240, + context=False) @classmethod def __setup__(cls): @@ -79,7 +80,6 @@ class Translation(ModelSQL, ModelView): 'UNIQUE (name, res_id, lang, type, src_md5, module)', 'Translation must be unique'), ] - cls._max_len = 10240 @classmethod def __register__(cls, module_name): From 008cc37e900be0a1561c912173cdece3e4eda35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Nov 2012 22:49:41 +0100 Subject: [PATCH 11/85] Add missing context when filling cache from search (transplanted from 4a73e09049b47932fede96fcfa1525724e072b1b) --- trytond/model/modelsql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index 923ab2e38f..b2fca69225 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -1203,7 +1203,7 @@ class ModelSQL(ModelStorage): cursor.execute(query_str, tables_args + qu2) rows = cursor.dictfetchmany(cursor.IN_MAX) - cache = cursor.get_cache() + cache = cursor.get_cache(Transaction().context) cache.setdefault(cls.__name__, LRUDict(RECORD_CACHE_SIZE)) delete_records = Transaction().delete_records.setdefault(cls.__name__, set()) From 8fa058ab8ad360a8edc98c5d0e0d7ada8f0c7b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 28 Nov 2012 22:37:57 +0100 Subject: [PATCH 12/85] Store transaction counter on local cache As the cache is shared with many instances, the counter must also be shared. review599004 (transplanted from 3d738bc28960c886bc21a1c5d0a75120476aa209) --- trytond/model/modelstorage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index 55be1c627c..cd2f0fbc27 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -1123,7 +1123,7 @@ class ModelStorage(Model): self._local_cache = _local_cache else: self._local_cache = LRUDict(RECORD_CACHE_SIZE) - self._local_counter = Transaction().counter + self._local_cache.counter = Transaction().counter @property def _cache(self): @@ -1140,9 +1140,9 @@ class ModelStorage(Model): raise counter = Transaction().counter - if self._local_counter != counter: + if self._local_cache.counter != counter: self._local_cache.clear() - self._local_counter = counter + self._local_cache.counter = counter try: return self._local_cache[self.id][name] except KeyError: From d075895127a77e4b7ca4ee24cdaa1fba0e8f56b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 5 Dec 2012 13:40:49 +0100 Subject: [PATCH 13/85] Add missing call to set_timezone review599006 (transplanted from 4ac46a5d21910a386b5d9d45af08cdf421b5a7b0) --- trytond/server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/trytond/server.py b/trytond/server.py index ff71446575..92a265266d 100644 --- a/trytond/server.py +++ b/trytond/server.py @@ -31,6 +31,7 @@ class TrytonServer(object): CONFIG.update_etc(options['configfile']) CONFIG.update_cmdline(options) + CONFIG.set_timezone() if CONFIG['logfile']: logf = CONFIG['logfile'] From 50e4666ef94a4aa127ac05dce26f8834aa288da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 11 Dec 2012 22:57:04 +0100 Subject: [PATCH 14/85] Fix Cache to use the local thread context (transplanted from ad5a06da9a7faa14567f01a0e91695fb7606099b) --- trytond/cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/cache.py b/trytond/cache.py index bb46a8c064..c92b063af2 100644 --- a/trytond/cache.py +++ b/trytond/cache.py @@ -27,7 +27,7 @@ class Cache(object): def _key(self, key): if self.context: - return (key, Transaction().user, repr(Transaction.context)) + return (key, Transaction().user, repr(Transaction().context)) return key def get(self, key, default=None): From 6e35f9e1eac8314d5487219391bf7746fcf27df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 15 Dec 2012 22:28:08 +0100 Subject: [PATCH 15/85] Fix on_change method signature for AR issue2929 (transplanted from c46b968de8e3d328068b422c1f754c68aaab8f89) --- doc/ref/models/fields.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ref/models/fields.rst b/doc/ref/models/fields.rst index 5861aa9f30..9294444435 100644 --- a/doc/ref/models/fields.rst +++ b/doc/ref/models/fields.rst @@ -82,7 +82,7 @@ method ``on_change_`` of the model when the user changes the current field value and will give the values of each fields in this list. The method signature is:: - on_change_(values) + on_change_() This method must return a dictionary with the values of fields to be updated. @@ -102,7 +102,7 @@ around. If this attribute is set, the client will call the method fields defined in the list and will give the values of each fields in this list. The method signature is:: - on_change_with_(values) + on_change_with_() This method must return the new value of the field. From 15d84fa08f7b146bc370ba31c6eb8d42c9580170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 23 Dec 2012 16:28:03 +0100 Subject: [PATCH 16/85] Prepare release 2.6.2 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 84391cdf8a..46608ab127 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.2 - 2012-12-23 +* Bug fixes (see mercurial logs for details) + Version 2.6.1 - 2012-11-05 * Bug fixes (see mercurial logs for details) From 2108f05c2d4a0e1f560a7699f1184074213e1a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 23 Dec 2012 16:28:04 +0100 Subject: [PATCH 17/85] Added tag 2.6.2 for changeset f607e7678c2c --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index fb4c0712dc..3686265483 100644 --- a/.hgtags +++ b/.hgtags @@ -8,3 +8,4 @@ af3a6063b46bf8739a513a06400fbb9858b5869b 1.8.0 640af4420c8eace7ee59a432bec54692f4808b20 2.4.0 36530840a1d0dce354bbaa58ec849a409d306d83 2.6.0 145684ebd2d802461474139c336f993b74186de4 2.6.1 +f607e7678c2c50271703e19c6bc51f60f91ecb4d 2.6.2 From 9ae617e067bddda091927d1512eef72e987f3852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 23 Dec 2012 16:28:34 +0100 Subject: [PATCH 18/85] 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 8d36f360e9..5c5522637a 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 = "2.6.2" +VERSION = "2.6.3" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From e87bb5fc59d425819d17481a51d2913d182877fa Mon Sep 17 00:00:00 2001 From: Laurent Defert Date: Tue, 18 Dec 2012 15:40:33 +0100 Subject: [PATCH 19/85] Remove deprecated reports initialization Remove code that used to initialize reports with undefined classes. This initialization is done from Pool.get() method instead. issue2933 review611004 (transplanted from a99c0c6f4c5f3089c5d150893eeb4dfcf8710dd7) --- trytond/modules/__init__.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/trytond/modules/__init__.py b/trytond/modules/__init__.py index 0df44940c5..b9bdd948ed 100644 --- a/trytond/modules/__init__.py +++ b/trytond/modules/__init__.py @@ -269,21 +269,6 @@ def load_module_graph(graph, pool, lang=None): cursor.commit() - # Create missing reports - from trytond.report import Report - ActionReport = pool.get('ir.action.report') - reports = ActionReport.search([ - ('module', '=', module), - ]) - report_names = pool.object_name_list(type='report') - for report in reports: - report_name = report.report_name - if report_name not in report_names: - report = object.__new__(Report) - report.__name__ = report_name - pool.add(report, type='report') - report.__init__() - for model_name in models_to_update_history: model = pool.get(model_name) if model._history: From a531e90a1f0a957c01b6aafad5b62b5db8fe5af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 23 Dec 2012 22:56:09 +0100 Subject: [PATCH 20/85] Fix read relate value when id is 0 review618002 (transplanted from 61a94a11e42b872f7026a129a28f0b6c83f32865) --- trytond/model/modelsql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index b2fca69225..d80f4f9900 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -636,7 +636,7 @@ class ModelSQL(ModelStorage): if hasattr(cls._fields[field], 'datetime_field') \ and cls._fields[field].datetime_field: for record in res: - if not record[field]: + if record[field] is None: continue with Transaction().set_context(_datetime=record[ cls._fields[field].datetime_field]): From 00b58bab15be16d77efa97b0fa1194a83de15884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 27 Dec 2012 22:27:57 +0100 Subject: [PATCH 21/85] Fix wrong cache name for User._get_login (transplanted from 38ab65b6b991d2dcca3e8a22bd859aecb88de4fe) --- 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 3d6d4eea7f..c8da3a1072 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -438,7 +438,7 @@ class User(ModelSQL, ModelView): @classmethod def _get_login(cls, login): - result = cls._get_groups_cache.get(login) + result = cls._get_login_cache.get(login) if result: return result cursor = Transaction().cursor @@ -446,7 +446,7 @@ class User(ModelSQL, ModelView): 'FROM "' + cls._table + '" ' 'WHERE login = %s AND active', (login,)) result = cursor.fetchone() or (None, None, None) - cls._get_groups_cache.set(login, result) + cls._get_login_cache.set(login, result) return result @classmethod From 4c8c6458137c941aedbeec7fd0b8d490b5f894f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 27 Dec 2012 22:36:33 +0100 Subject: [PATCH 22/85] Fix name in Translation.set_ids for ir.model{,.field} (transplanted from 21dfe743631efc521fe0ccc965a183384c0657ce) --- trytond/ir/translation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py index f472296823..31079d250e 100644 --- a/trytond/ir/translation.py +++ b/trytond/ir/translation.py @@ -266,7 +266,9 @@ class Translation(ModelSQL, ModelView): records = Model.browse(ids) for record in records: if ttype in ('field', 'help'): - name = record.model + ',' + record.name + name = record.model.model + ',' + record.name + else: + name = record.model + ',' + field_name translation2 = cls.search([ ('lang', '=', lang), ('type', '=', ttype), From f68de75800150271eccabd7b5d917301ca5a014a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 26 Jan 2013 15:10:22 +0100 Subject: [PATCH 23/85] Fix doc of Function.getter for AR review641002 (transplanted from 125db9a2cec2e2245c96535fe1f5a9efc59442bc) --- doc/ref/models/fields.rst | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/doc/ref/models/fields.rst b/doc/ref/models/fields.rst index 9294444435..f4b72db95b 100644 --- a/doc/ref/models/fields.rst +++ b/doc/ref/models/fields.rst @@ -570,21 +570,34 @@ A function field can emulate any other given `field`. .. attribute:: Function.getter - The name of the classmethod of the :class:`~trytond.model.Model` for - getting values. - The signature of the method is:: + The name of the classmethod or instance of the + :class:`~trytond.model.Model` for getting values. + The signature of the classmethod is:: - getter(ids, name) + getter(instances, name) where `name` is the name of the field, and it must return a dictionary with - a value for each ids. + a value for each instance. - Or the signature of the method is:: + The signature of the instancemethod is:: - getter(ids, names) + getter(name) + + where `name` is the name of the field, and it must return the value. + + Or the signature of the classmethod is:: + + getter(instances, names) where `names` is a list of name fields, and it must return a dictionary - containing for each names a dictionary with a value for each ids. + containing for each names a dictionary with a value for each instance. + + the signature of the instancemethod is:: + + getter(names) + + where `names` is a list of name fields, and it must return a dictionary + containing for each names the value. :class:`Function` has some extra optional arguments: From 6d75cb1f1800a7db7dbbdc98b562c6abe38aa305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 5 Feb 2013 19:19:22 +0100 Subject: [PATCH 24/85] Fix documentation about unsupported names keyword on instance method getter issue2987 review663002 (transplanted from 27df6a16c7f3085b20d521097f2c1509f61d30a7) --- doc/ref/models/fields.rst | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/doc/ref/models/fields.rst b/doc/ref/models/fields.rst index f4b72db95b..4de28d85fb 100644 --- a/doc/ref/models/fields.rst +++ b/doc/ref/models/fields.rst @@ -579,12 +579,6 @@ A function field can emulate any other given `field`. where `name` is the name of the field, and it must return a dictionary with a value for each instance. - The signature of the instancemethod is:: - - getter(name) - - where `name` is the name of the field, and it must return the value. - Or the signature of the classmethod is:: getter(instances, names) @@ -592,12 +586,11 @@ A function field can emulate any other given `field`. where `names` is a list of name fields, and it must return a dictionary containing for each names a dictionary with a value for each instance. - the signature of the instancemethod is:: + The signature of the instancemethod is:: - getter(names) + getter(name) - where `names` is a list of name fields, and it must return a dictionary - containing for each names the value. + where `name` is the name of the field, and it must return the value. :class:`Function` has some extra optional arguments: From c1f81e06aee17ab1ad90c2a6f0d8d5f12f2a6c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 4 Feb 2013 20:02:37 +0100 Subject: [PATCH 25/85] Fix copy when relation field is a Reference review654003 (transplanted from 677ba29437ed1cf09aa27c4fe54cbddaaa2e80ad) --- trytond/model/modelstorage.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index cd2f0fbc27..13e2aa4c5c 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -293,8 +293,16 @@ class ModelStorage(Model): field_defs[field_name]['relation']) relation_field = field_defs[field_name]['relation_field'] if relation_field: + if relation_field in Relation._fields: + field = Relation._fields[relation_field] + else: + field = Relation._inherit_fields[relation_field][2] + if field._type == 'reference': + value = str(new_record) + else: + value = new_record.id Relation.copy(Relation.browse(data_o2m[field_name]), - default={relation_field: new_ids[data_id]}) + default={relation_field: value}) fields_translate = {} for field_name, field in field_defs.iteritems(): From 97a97d9d3939db7a8334d60cb8f72d45c66e1364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 4 Feb 2013 20:08:10 +0100 Subject: [PATCH 26/85] local_cache and model2ids must depend on datetime review650002 (transplanted from 93a0f6e189e361a622bc88e7d6265dc63abd6606) --- trytond/model/modelstorage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index 13e2aa4c5c..27f3efd95a 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -1262,14 +1262,14 @@ class ModelStorage(Model): Model = field.get_target() except KeyError: return value + datetime_ = None if getattr(field, 'datetime_field', None): + datetime_ = data.get(field.datetime_field) _datetime = data.get(field.datetime_field) - else: - _datetime = None with Transaction().set_context(_datetime=_datetime): - local_cache = model2cache.setdefault(Model, + local_cache = model2cache.setdefault((Model, datetime_), LRUDict(RECORD_CACHE_SIZE)) - ids = model2ids.setdefault(Model, []) + ids = model2ids.setdefault((Model, datetime_), []) if field._type in ('many2one', 'one2one', 'reference'): ids.append(value) return Model(value, _ids=ids, _local_cache=local_cache) From 84cc73906eea3351a78c024e046ea47b24aba00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 11 Feb 2013 10:22:40 +0100 Subject: [PATCH 27/85] Fix typo in changeset 52225868c63c --- trytond/model/modelstorage.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index 27f3efd95a..39d5c9dff7 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -1265,8 +1265,7 @@ class ModelStorage(Model): datetime_ = None if getattr(field, 'datetime_field', None): datetime_ = data.get(field.datetime_field) - _datetime = data.get(field.datetime_field) - with Transaction().set_context(_datetime=_datetime): + with Transaction().set_context(_datetime=datetime_): local_cache = model2cache.setdefault((Model, datetime_), LRUDict(RECORD_CACHE_SIZE)) ids = model2ids.setdefault((Model, datetime_), []) From 347c3ac8349da5fc25b24cd95cdf7132eb17eae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 12 Feb 2013 18:08:42 +0100 Subject: [PATCH 28/85] Prepare release 2.6.3 --- CHANGELOG | 3 +++ COPYRIGHT | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 46608ab127..f906b7b77b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.3 - 2013-02-12 +* Bug fixes (see mercurial logs for details) + Version 2.6.2 - 2012-12-23 * Bug fixes (see mercurial logs for details) diff --git a/COPYRIGHT b/COPYRIGHT index cc1cebfa6a..21df598293 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,7 +1,7 @@ Copyright (C) 2004-2008 Tiny SPRL. -Copyright (C) 2007-2012 Cédric Krier. +Copyright (C) 2007-2013 Cédric Krier. Copyright (C) 2007-2012 Bertrand Chenal. -Copyright (C) 2008-2012 B2CK SPRL. +Copyright (C) 2008-2013 B2CK SPRL. Copyright (C) 2011 Openlabs Technologies & Consulting (P) Ltd. This program is free software: you can redistribute it and/or modify From a4dfaa33b9198a4182d9373b23af8dce025e44f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 12 Feb 2013 18:08:43 +0100 Subject: [PATCH 29/85] Added tag 2.6.3 for changeset 65f402c1c233 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 3686265483..4a946e0353 100644 --- a/.hgtags +++ b/.hgtags @@ -9,3 +9,4 @@ af3a6063b46bf8739a513a06400fbb9858b5869b 1.8.0 36530840a1d0dce354bbaa58ec849a409d306d83 2.6.0 145684ebd2d802461474139c336f993b74186de4 2.6.1 f607e7678c2c50271703e19c6bc51f60f91ecb4d 2.6.2 +65f402c1c2334a2c804d4a69c5b84a42e722fc04 2.6.3 From 431c0069868a551f47f999312704fdc23b5a76cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 12 Feb 2013 18:09:17 +0100 Subject: [PATCH 30/85] 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 5c5522637a..5f99f74f38 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 = "2.6.3" +VERSION = "2.6.4" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From dbe44fdbe39cf25eb679c6ebfe77bdf5bce76080 Mon Sep 17 00:00:00 2001 From: Ian Wilson Date: Fri, 15 Feb 2013 13:49:09 -0800 Subject: [PATCH 31/85] Update migration code to use new search and write api. Search returns record objects now and write expects a list of records. issue3002 review662004 (transplanted from b8c4783d32ab816d39371dd4279cbc65887ba2c8) --- trytond/ir/translation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py index 31079d250e..799dd8b098 100644 --- a/trytond/ir/translation.py +++ b/trytond/ir/translation.py @@ -105,9 +105,9 @@ class Translation(ModelSQL, ModelView): while translations: translations = cls.search([], offset=offset, limit=limit) offset += limit - for translation in cls.browse(translations): + for translation in translations: src_md5 = cls.get_src_md5(translation.src) - cls.write(translation.id, { + cls.write([translation], { 'src_md5': src_md5, }) table = TableHandler(cursor, cls, module_name) From a6d651b9127d5e748e041a7379ba78ade0bb2810 Mon Sep 17 00:00:00 2001 From: Ian Wilson Date: Fri, 15 Feb 2013 14:06:13 -0800 Subject: [PATCH 32/85] Use new search API. The search method returns records now so browse is no longer needed. issue3004 review672002 (transplanted from c225daf977e090bd33fc2e749f68addb42c1d0bd) --- trytond/ir/action.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trytond/ir/action.py b/trytond/ir/action.py index 30eb92d124..f0e0a5f1bd 100644 --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -65,11 +65,11 @@ class Action(ModelSQL, ModelView): 'ir.action.url', ): Action = pool.get(action_type) - action_id2 = Action.search([ + actions = Action.search([ ('id', '=', action_id), ]) - if action_id2: - action = Action.browse(action_id2[0]) + if actions: + action, = actions return action.action.id @classmethod From e7657b899f99564f935f8c8ee31c479f77c8ce7c Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Mon, 18 Feb 2013 00:40:02 +0100 Subject: [PATCH 33/85] 'Configure users' wizard: clean state after saving issue2973 review657003 (transplanted from 3c5aba7db757db5b07f86c7c6201a043f6fe8e64) --- trytond/res/user.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/trytond/res/user.py b/trytond/res/user.py index c8da3a1072..6e6e91db84 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -575,5 +575,8 @@ class UserConfig(Wizard): add = StateTransition() def transition_add(self): + pool = Pool() + User = pool.get('res.user') self.user.save() + self.user = User() return 'user' From fb9321c0fd71e5c8065ce386cf5468b3f3d9ac10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 21 Feb 2013 23:31:08 +0100 Subject: [PATCH 34/85] Delete takes instance not ids issue3015 (transplanted from 0080d712191b7f903b6a0e9da2748dba66bbda93) --- trytond/ir/action.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/ir/action.py b/trytond/ir/action.py index f0e0a5f1bd..c3fdc3b0a6 100644 --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -728,7 +728,7 @@ class ActionActWindow(ModelSQL, ModelView): def delete(cls, act_windows): Action = Pool().get('ir.action') - actions = [x.action.id for x in act_windows] + actions = [x.action for x in act_windows] super(ActionActWindow, cls).delete(act_windows) Action.delete(actions) @@ -824,7 +824,7 @@ class ActionWizard(ModelSQL, ModelView): pool = Pool() Action = pool.get('ir.action') - actions = [x.action.id for x in wizards] + actions = [x.action for x in wizards] super(ActionWizard, cls).delete(wizards) Action.delete(actions) From 796a16e4032c5de5b6581f7843016a480664accd Mon Sep 17 00:00:00 2001 From: Ian Wilson Date: Mon, 25 Feb 2013 12:53:32 -0800 Subject: [PATCH 35/85] Data must be item and not list. Unpack data into an item from a list to be consistent. issue3016 review679002 (transplanted from e801061343d6bb6190784e44183818ab3e83df62) --- trytond/convert.py | 1 + 1 file changed, 1 insertion(+) diff --git a/trytond/convert.py b/trytond/convert.py index 23fe53cd52..f15b13f289 100644 --- a/trytond/convert.py +++ b/trytond/convert.py @@ -606,6 +606,7 @@ class TrytondXmlHandler(sax.handler.ContentHandler): 'db_id': inherit_db_ids[table], 'inherit': True, }) + data, = data else: data = self.ModelData.create({ 'fs_id': fs_id, From c864e0ea97e6ffcd89c2878d169739d53d10ada6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 26 Feb 2013 13:03:31 +0100 Subject: [PATCH 36/85] Fix wrong instantiation when removing module issue3025 review689002 (transplanted from ce293460554c527c8c5791f36f6958a13802f5ec) --- trytond/modules/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trytond/modules/__init__.py b/trytond/modules/__init__.py index b9bdd948ed..96374e17e7 100644 --- a/trytond/modules/__init__.py +++ b/trytond/modules/__init__.py @@ -404,7 +404,8 @@ def load_modules(database_name, pool, update=False, lang=None): 'WHERE module = %s ' \ 'ORDER BY id DESC', (mod_name,)) for rmod, rid in cursor.fetchall(): - pool.get(rmod).delete([rmod(rid)]) + Model = pool.get(rmod) + Model.delete([Model(rid)]) cursor.commit() cursor.execute("UPDATE ir_module_module SET state = %s " \ "WHERE state IN ('to remove')", ('uninstalled',)) From 7ce8e632bcc13cce3876e603199b83bbc4787220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 26 Feb 2013 18:06:34 +0100 Subject: [PATCH 37/85] Remove button type for documentation All types of button have been merged in changeset c5324dfc9882 (transplanted from 5a060589917fc3137cf07e89ec2b6049ca164950) --- doc/topics/views/index.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/topics/views/index.rst b/doc/topics/views/index.rst index af1aa4e661..93872e4126 100644 --- a/doc/topics/views/index.rst +++ b/doc/topics/views/index.rst @@ -280,9 +280,6 @@ Display a button. * ``string``: The string that will be displayed inside the button. - * ``type``: It can be ``object`` or ``action``. The default is ``object``. - It defines which type of action must be run when clicking on it. - * ``name``: The name of the action: * ``object``: the name of the function that will called. The function From 66814b908918f22090d593bf3880714241ddeaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 4 Mar 2013 21:30:17 +0100 Subject: [PATCH 38/85] Fix check of _sql_error_messages issue3021 review682002 (transplanted from b0bd4835cfc875baf1bf8124e7e23c4cc45c3483) --- trytond/model/modelsql.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index d80f4f9900..01f7110a68 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -886,7 +886,7 @@ class ModelSQL(ModelStorage): for name, _, error in cls._sql_constraints: if name in exception[0]: cls.raise_user_error(error) - for name, error in cls._sql_error_messages: + for name, error in cls._sql_error_messages.iteritems(): if name in exception[0]: cls.raise_user_error(error) raise @@ -1108,7 +1108,7 @@ class ModelSQL(ModelStorage): for name, _, error in cls._sql_constraints: if name in exception[0]: cls.raise_user_error(error) - for name, error in cls._sql_error_messages: + for name, error in cls._sql_error_messages.iteritems(): if name in exception[0]: cls.raise_user_error(error) raise From bf7886001bf1235d84af94f1bd13bd903433053f Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Tue, 5 Mar 2013 00:15:03 +0100 Subject: [PATCH 39/85] Consider that reference fields may be of tuple type in menu. review699002 (transplanted from 86d766efbcc2f94aaf26710705b569e552d629b3) --- trytond/ir/ui/menu.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trytond/ir/ui/menu.py b/trytond/ir/ui/menu.py index c7ea2dda2c..df5c2630f5 100644 --- a/trytond/ir/ui/menu.py +++ b/trytond/ir/ui/menu.py @@ -209,7 +209,10 @@ class UIMenu(ModelSQL, ModelView): if action_keywords: with Transaction().set_context(_timestamp=False): ActionKeyword.delete(action_keywords) - action_type, action_id = value.split(',') + if isinstance(value, basestring): + action_type, action_id = value.split(',') + else: + action_type, action_id = value if not int(action_id): return Action = pool.get(action_type) From 7a8aa90efcee64ba785c56d7d250e3df874651a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 6 Mar 2013 13:32:16 +0100 Subject: [PATCH 40/85] Don't use Model from res module in ir module As ir module doesn't depend on res module, it should not use the Model of it. (transplanted from f89e104aad506c06c572c76166431ccbd9953def) --- trytond/ir/model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/trytond/ir/model.py b/trytond/ir/model.py index 74800261c9..1652970e71 100644 --- a/trytond/ir/model.py +++ b/trytond/ir/model.py @@ -311,7 +311,6 @@ class ModelAccess(ModelSQL, ModelView): 'Return access for models' pool = Pool() Model = pool.get('ir.model') - UserGroup = pool.get('res.user-res.group') cursor = Transaction().cursor user = Transaction().user @@ -335,12 +334,12 @@ class ModelAccess(ModelSQL, ModelView): 'FROM "%s" AS a ' 'JOIN "%s" AS m ' 'ON (a.model = m.id) ' - 'LEFT JOIN "%s" AS gu ' + 'LEFT JOIN "res_user-res_group" AS gu ' 'ON (gu."group" = a."group") ' 'WHERE m.model IN (' + ','.join(('%%s',) * len(models)) + ') ' 'AND (gu."user" = %%s OR a."group" IS NULL) ' 'GROUP BY m.model') - % (cls._table, Model._table, UserGroup._table), + % (cls._table, Model._table), list(models) + [Transaction().user]) access.update(dict( (m, {'read': r, 'write': w, 'create': c, 'delete': d}) From 93457211b95f1aa648a00500d1849f0380c50e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 14 Mar 2013 20:06:10 +0100 Subject: [PATCH 41/85] Backed out changeset e7127dd2a97e --- trytond/ir/model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trytond/ir/model.py b/trytond/ir/model.py index 1652970e71..74800261c9 100644 --- a/trytond/ir/model.py +++ b/trytond/ir/model.py @@ -311,6 +311,7 @@ class ModelAccess(ModelSQL, ModelView): 'Return access for models' pool = Pool() Model = pool.get('ir.model') + UserGroup = pool.get('res.user-res.group') cursor = Transaction().cursor user = Transaction().user @@ -334,12 +335,12 @@ class ModelAccess(ModelSQL, ModelView): 'FROM "%s" AS a ' 'JOIN "%s" AS m ' 'ON (a.model = m.id) ' - 'LEFT JOIN "res_user-res_group" AS gu ' + 'LEFT JOIN "%s" AS gu ' 'ON (gu."group" = a."group") ' 'WHERE m.model IN (' + ','.join(('%%s',) * len(models)) + ') ' 'AND (gu."user" = %%s OR a."group" IS NULL) ' 'GROUP BY m.model') - % (cls._table, Model._table), + % (cls._table, Model._table, UserGroup._table), list(models) + [Transaction().user]) access.update(dict( (m, {'read': r, 'write': w, 'create': c, 'delete': d}) From 0dcaace466325e96c0d6d5100b64b5271bf26f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 14 Mar 2013 20:11:24 +0100 Subject: [PATCH 42/85] Don't use Model from res module in ir module As ir module doesn't depend on res module, it should not use the Model of it. (transplanted from f89e104aad506c06c572c76166431ccbd9953def) --- trytond/ir/model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/trytond/ir/model.py b/trytond/ir/model.py index 74800261c9..9b3880d3b2 100644 --- a/trytond/ir/model.py +++ b/trytond/ir/model.py @@ -450,7 +450,6 @@ class ModelFieldAccess(ModelSQL, ModelView): pool = Pool() Model = pool.get('ir.model') ModelField = pool.get('ir.model.field') - UserGroup = pool.get('res.user-res.group') cursor = Transaction().cursor key = (model_name, mode, access, Transaction().user) @@ -464,13 +463,13 @@ class ModelFieldAccess(ModelSQL, ModelView): 'ON (a.field = f.id) ' 'JOIN "%s" AS m ' 'ON (f.model = m.id) ' - 'LEFT JOIN "%s" AS gu ' + 'LEFT JOIN "res_user-res_group" AS gu ' 'ON (gu."group" = a."group") ' 'WHERE m.model = %%s ' 'AND (gu."user" = %%s OR a."group" IS NULL) ' 'GROUP BY f.name' % (mode, cls._table, ModelField._table, - Model._table, UserGroup._table), (model_name, + Model._table), (model_name, Transaction().user)) accesses = dict(cursor.fetchall()) cls._get_access_cache.set(key, accesses) From 02c21a42b02d07b9591d73be8670f89867f3a075 Mon Sep 17 00:00:00 2001 From: Sharoon Thomas Date: Wed, 6 Mar 2013 16:59:54 +0100 Subject: [PATCH 43/85] Fix records built as argument by trigger_action Fix the construction of active records sent as arguments to trigger action functions to use the source model instead of action_model. issue3026 review690002 (transplanted from 46203b4a3bd14947e94075458d6b879c903c2c1f) --- trytond/ir/trigger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trytond/ir/trigger.py b/trytond/ir/trigger.py index e8da5d4e8a..06032bf232 100644 --- a/trytond/ir/trigger.py +++ b/trytond/ir/trigger.py @@ -161,7 +161,8 @@ class Trigger(ModelSQL, ModelView): """ pool = Pool() TriggerLog = pool.get('ir.trigger.log') - Model = pool.get(trigger.action_model.model) + Model = pool.get(trigger.model.model) + ActionModel = pool.get(trigger.action_model.model) cursor = Transaction().cursor ids = map(int, records) @@ -221,7 +222,7 @@ class Trigger(ModelSQL, ModelView): records = Model.browse(ids) if records: - getattr(Model, trigger.action_function)(records, trigger) + getattr(ActionModel, trigger.action_function)(records, trigger) if trigger.limit_number or trigger.minimum_delay: for record in records: TriggerLog.create({ From dcd875f4634d8d49e2348a28e5d8dfd355eb0f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 12 Mar 2013 11:47:14 +0100 Subject: [PATCH 44/85] Fix check of _sql_error_messages (transplanted from 4e5f1c24ce3ddad5f362e734138bc67643bad079) --- trytond/model/modelsql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index 01f7110a68..4d0ab9f573 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -369,7 +369,7 @@ class ModelSQL(ModelStorage): for name, _, error in cls._sql_constraints: if name in exception[0]: cls.raise_user_error(error) - for name, error in cls._sql_error_messages: + for name, error in cls._sql_error_messages.iteritems(): if name in exception[0]: cls.raise_user_error(error) raise From 31a7b51c7366cc83371bbafd8b1181864d88f683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 13 Mar 2013 18:42:30 +0100 Subject: [PATCH 45/85] Fix local variable 'microseconds' referenced before assignment issue3049 (transplanted from cdd7c4de7770e3c69fcb584325c2325d91781c06) --- trytond/backend/sqlite/database.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trytond/backend/sqlite/database.py b/trytond/backend/sqlite/database.py index 78715d47c7..1d902f1a31 100644 --- a/trytond/backend/sqlite/database.py +++ b/trytond/backend/sqlite/database.py @@ -39,6 +39,8 @@ def extract(lookup_type, date): hours, minutes, seconds = map(int, timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) + else: + microseconds = 0 date = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds) except Exception: From 8ba76a4b61353578d56708830adb07716b337e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 15 Mar 2013 00:52:16 +0100 Subject: [PATCH 46/85] Fix Warning.check to use instance for delete issue3065 review715002 (transplanted from 04d3e10e97e0c8145bc36706f066109b058e61d6) --- trytond/res/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/res/user.py b/trytond/res/user.py index 6e6e91db84..7e80264bb1 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -549,7 +549,7 @@ class Warning_(ModelSQL, ModelView): ]) if not warnings: return True - cls.delete([x.id for x in warnings if not x.always]) + cls.delete([x for x in warnings if not x.always]) return False From 82a8a122aeff72e77f901bcef56e0da1aabf7f22 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Mon, 8 Apr 2013 10:57:39 +0200 Subject: [PATCH 47/85] View: remove encoding declaration (fix lxml usage) issue3119 review765002 (transplanted from 861d25f41f6232ed43b25cac63ee3892313332e4) --- trytond/model/modelview.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py index 7424b38a6e..8997f5d7e8 100644 --- a/trytond/model/modelview.py +++ b/trytond/model/modelview.py @@ -202,7 +202,7 @@ class ModelView(Model): else: if view_type == 'form': res = cls.fields_get() - xml = '''''' \ + xml = '''''' \ '''
''' % (cls.__doc__,) for i in res: if i in ('create_uid', 'create_date', @@ -220,7 +220,7 @@ class ModelView(Model): field = 'id' if cls._rec_name in cls._fields: field = cls._rec_name - xml = '''''' \ + xml = '''''' \ '''''' \ % (cls.__doc__, field) else: From 3870d7ae44d485549ed1b529bbb3d123227dd266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 12 Apr 2013 19:29:23 +0200 Subject: [PATCH 48/85] Remove ModelSQL.default_sequence from the doc ModelSQL.default_sequence was removed in 2.6 issue3143 (transplanted from f7020a319b7adeca49b08202732a0fc87daa68df) --- doc/ref/models/models.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/ref/models/models.rst b/doc/ref/models/models.rst index 10f173cf4f..fb7d2688a7 100644 --- a/doc/ref/models/models.rst +++ b/doc/ref/models/models.rst @@ -388,10 +388,6 @@ Class attributes are: Class methods: -.. classmethod:: ModelSQL.default_sequence() - - Return default value for sequence field if the model has one. - .. classmethod:: ModelSQL.table_query() Could be overrided to use a custom SQL query instead of a table of the From 0b39b610cff18b371552b7003dc507609b4114b6 Mon Sep 17 00:00:00 2001 From: Ralf Peschke Date: Sat, 13 Apr 2013 10:28:07 +0200 Subject: [PATCH 49/85] Fix: on import_data zero values shouldn't be converted to None import_data method converts zero values to None. As a consequence such records don't pass the required constraint for such fields issue3136 review779002 (transplanted from 88183e783aa788ff22a03bf1b672209acb4860e4) --- trytond/model/modelstorage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index 39d5c9dff7..b33f740c31 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -669,11 +669,11 @@ class ModelStorage(Model): else: res = bool(int(value)) elif field_type == 'integer': - res = value and int(value) or None + res = int(value) if value else None elif field_type == 'float': - res = value and float(value) or None + res = float(value) if value else None elif field_type == 'numeric': - res = value and Decimal(value) or None + res = Decimal(value) if value else None elif field_type == 'date': res = value and datetime.date(*time.strptime(value, '%Y-%m-%d')[:3]) From 5fe6d40cc00a318d7d845316ec327b7e28a7541e Mon Sep 17 00:00:00 2001 From: Ralf Peschke Date: Sat, 13 Apr 2013 11:07:33 +0200 Subject: [PATCH 50/85] Use value instead of record instance on import_data Importing records with m2o- and m2m-relations import_data gives record instances to the create-method of the object instead of record-id's. Creating the same object using the GUI the client gives record-id's. On error the record-instances can't be serialized by JSON and the common error "500 internal server error" will be reported to the client issue3124 review767002 (transplanted from 6426b8830dd72bdc89891709dbd319d924384cd1) --- trytond/model/modelstorage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index b33f740c31..a7fecf0fa4 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -557,7 +557,7 @@ class ModelStorage(Model): warn('too_many_relations_found', value, relation) res = None else: - res = res[0] + res = res[0].id return res def get_many2many(relation, value): @@ -577,7 +577,7 @@ class ModelStorage(Model): else: res.extend(res2) if len(res): - res = [('set', res)] + res = [('set', [x.id for x in res])] return res def get_one2one(relation, value): From e3e246ef645a6245cec3fffebce75186e93f2afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 17 Apr 2013 17:44:34 +0200 Subject: [PATCH 51/85] Fix ir_translation clause on res_id Since changeset 3e12e07af677, res_id is NULL instead of 0. issue3161 review805002 (transplanted from 1a74aaf6feb4213892aa1927be708497386c60aa) --- trytond/model/modelsql.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index 4d0ab9f573..b85124f1d9 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -1677,7 +1677,7 @@ class ModelSQL(ModelStorage): table_join = 'LEFT JOIN "ir_translation" ' \ 'ON (ir_translation.name = ' \ 'ir_model.model||\',%s\' ' \ - 'AND ir_translation.res_id = 0 ' \ + 'AND ir_translation.res_id IS NULL ' \ 'AND ir_translation.lang = %%s ' \ 'AND ir_translation.type = \'model\' ' \ 'AND ir_translation.fuzzy = %%s)' % \ @@ -1692,7 +1692,7 @@ class ModelSQL(ModelStorage): 'LEFT JOIN "ir_translation" ' \ 'ON (ir_translation.name = ' \ 'ir_model.model||\',\'||%s.name ' \ - 'AND ir_translation.res_id = 0 ' \ + 'AND ir_translation.res_id IS NULL ' \ 'AND ir_translation.lang = %%s ' \ 'AND ir_translation.type = \'%s\' ' \ 'AND ir_translation.fuzzy = %%s)' % \ @@ -1990,7 +1990,7 @@ class ModelSQL(ModelStorage): table_join = 'LEFT JOIN "ir_translation" ' \ 'AS "%s" ON ' \ '("%s".name = "ir_model".model||\',%s\' ' \ - 'AND "%s".res_id = 0 ' \ + 'AND "%s".res_id IS NULL ' \ 'AND "%s".lang = %%s ' \ 'AND "%s".type = \'model\' ' \ 'AND "%s".fuzzy = %%s)' % \ @@ -2009,7 +2009,7 @@ class ModelSQL(ModelStorage): table_join = 'LEFT JOIN "ir_translation" ' \ 'AS "%s" ON ' \ '("%s".name = "ir_model".model||\',\'||%s.name ' \ - 'AND "%s".res_id = 0 ' \ + 'AND "%s".res_id IS NULL ' \ 'AND "%s".lang = %%s ' \ 'AND "%s".type = \'%s\' ' \ 'AND "%s".fuzzy = %%s)' % \ From 408c8528cba65bf09f4ca5bc91eae1b3facf2d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 17 Apr 2013 19:42:39 +0200 Subject: [PATCH 52/85] Fix get_data to return str instead of buffer (transplanted from 9d27d8712d6f038e08e8c8b20004233a9d0e0e1f) --- trytond/webdav/webdav.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/webdav/webdav.py b/trytond/webdav/webdav.py index 24663e46bd..04e26e369e 100644 --- a/trytond/webdav/webdav.py +++ b/trytond/webdav/webdav.py @@ -508,7 +508,7 @@ class Collection(ModelSQL, ModelView): data = DAV_NotFound try: if attachment.data is not None: - data = attachment.data + data = str(attachment.data) except Exception: pass if attachment.id == object_id: From 8c1f9fe7904a039864d5b840efbefebc97dfb395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 17 Apr 2013 19:43:19 +0200 Subject: [PATCH 53/85] Fix wrong import from PyWebDAV >= 0.9.8 (transplanted from 8798eb4435b6f68e5554510af02657579ff0d98d) --- trytond/webdav/webdav.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/webdav/webdav.py b/trytond/webdav/webdav.py index 04e26e369e..009f234bb6 100644 --- a/trytond/webdav/webdav.py +++ b/trytond/webdav/webdav.py @@ -586,7 +586,7 @@ class Collection(ModelSQL, ModelView): @classmethod def rmcol(cls, uri, cache=None): - from pywebdav.errors import DAV_Forbidden + from pywebdav.lib.errors import DAV_Forbidden object_name, object_id = cls._uri2object(uri, cache=cache) if object_name != 'webdav.collection' \ or not object_id: @@ -599,7 +599,7 @@ class Collection(ModelSQL, ModelView): @classmethod def rm(cls, uri, cache=None): - from pywebdav.errors import DAV_Forbidden + from pywebdav.lib.errors import DAV_Forbidden object_name, object_id = cls._uri2object(uri, cache=cache) if not object_name: raise DAV_Forbidden From bfe87bd64889b3e066f4a1c4b97efb2b2260fae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 17 Apr 2013 19:43:52 +0200 Subject: [PATCH 54/85] delete takes a list of instances (transplanted from c5c4abcbee65a88d055e5bfc0a00d6ef7917baa7) --- trytond/webdav/webdav.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/webdav/webdav.py b/trytond/webdav/webdav.py index 009f234bb6..5c3ad667a3 100644 --- a/trytond/webdav/webdav.py +++ b/trytond/webdav/webdav.py @@ -592,7 +592,7 @@ class Collection(ModelSQL, ModelView): or not object_id: raise DAV_Forbidden try: - cls.delete(object_id) + cls.delete([cls(object_id)]) except Exception: raise DAV_Forbidden return 200 @@ -609,7 +609,7 @@ class Collection(ModelSQL, ModelView): pool = Pool() Model = pool.get(object_name) try: - Model.delete(object_id) + Model.delete([Model(object_id)]) except Exception: raise DAV_Forbidden return 200 From dc74d0725d5d99102697ab098eeabab560c8b58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 May 2013 09:35:37 +0200 Subject: [PATCH 55/85] Prepare release 2.6.4 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f906b7b77b..b782ab51c3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.4 - 2013-05-02 +* Bug fixes (see mercurial logs for details) + Version 2.6.3 - 2013-02-12 * Bug fixes (see mercurial logs for details) From 34aeeef2501bb002c9f07ee7c9fb375e28b76e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 May 2013 09:35:38 +0200 Subject: [PATCH 56/85] Added tag 2.6.4 for changeset 590e1cb0a933 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 4a946e0353..ae6c035c3e 100644 --- a/.hgtags +++ b/.hgtags @@ -10,3 +10,4 @@ af3a6063b46bf8739a513a06400fbb9858b5869b 1.8.0 145684ebd2d802461474139c336f993b74186de4 2.6.1 f607e7678c2c50271703e19c6bc51f60f91ecb4d 2.6.2 65f402c1c2334a2c804d4a69c5b84a42e722fc04 2.6.3 +590e1cb0a933ec0afbcc8019db01a3f76620d1ae 2.6.4 From 6483fb1e4d47300cc174c1be47479f2a333e9dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 May 2013 09:35:59 +0200 Subject: [PATCH 57/85] 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 5f99f74f38..395ff22816 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 = "2.6.4" +VERSION = "2.6.5" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From 58704a46f77199c45ff576938e7dab1568ff5604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 4 May 2013 11:44:15 +0200 Subject: [PATCH 58/85] Allow None in child_of operator issue3190 review844002 (transplanted from 67208cffb07e8ab82e904a23f135fa8c6308d5a4) --- trytond/model/modelsql.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py index b85124f1d9..fbb5240b3a 100644 --- a/trytond/model/modelsql.py +++ b/trytond/model/modelsql.py @@ -1511,7 +1511,7 @@ class ModelSQL(ModelStorage): ids2 = map(int, Target.search([ ('rec_name', 'ilike', domain[i][2]), ], order=[])) - elif isinstance(domain[i][2], (int, long)): + elif not isinstance(domain[i][2], list): ids2 = [domain[i][2]] else: ids2 = domain[i][2] @@ -1605,7 +1605,7 @@ class ModelSQL(ModelStorage): ids2 = map(int, Field.search([ ('rec_name', 'like', domain[i][2]), ], order=[])) - elif isinstance(domain[i][2], (int, long)): + elif not isinstance(domain[i][2], list): ids2 = [domain[i][2]] else: ids2 = domain[i][2] From fa874f15a2405ba78f47c931b8483a94c03e5b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 18 May 2013 19:13:12 +0200 Subject: [PATCH 59/85] Fix validation of domain for One2One fields issue3206 review852003 (transplanted from 3765bc03294580c09839b03fa40ea42459376e2b) --- trytond/model/modelstorage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index a7fecf0fa4..b6f1ccb35f 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -933,7 +933,7 @@ class ModelStorage(Model): domain = PYSONDecoder(env).decode(pyson_domain) relation_ids = [] if getattr(record, field_name): - if field._type in ('many2one',): + if field._type in ('many2one', 'one2one'): relation_ids.append( getattr(record, field_name).id) else: @@ -953,7 +953,7 @@ class ModelStorage(Model): relation_ids = [] for record in records: if getattr(record, field_name): - if field._type in ('many2one',): + if field._type in ('many2one', 'one2one'): relation_ids.append( getattr(record, field_name).id) else: From f7a69e380ceb876a19a520c16b4551174feda87a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 9 Jun 2013 22:34:45 +0200 Subject: [PATCH 60/85] Prepare release 2.6.5 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index b782ab51c3..358f843e9f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.5 - 2013-06-09 +* Bug fixes (see mercurial logs for details) + Version 2.6.4 - 2013-05-02 * Bug fixes (see mercurial logs for details) From 872a882b99518f19e02e3ceda82ce079604aa46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 9 Jun 2013 22:34:46 +0200 Subject: [PATCH 61/85] Added tag 2.6.5 for changeset 0171fd1670c2 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index ae6c035c3e..effdc9644a 100644 --- a/.hgtags +++ b/.hgtags @@ -11,3 +11,4 @@ af3a6063b46bf8739a513a06400fbb9858b5869b 1.8.0 f607e7678c2c50271703e19c6bc51f60f91ecb4d 2.6.2 65f402c1c2334a2c804d4a69c5b84a42e722fc04 2.6.3 590e1cb0a933ec0afbcc8019db01a3f76620d1ae 2.6.4 +0171fd1670c2ad463062a35466a1fde751e2ed57 2.6.5 From a8848fc861925edc7835b087d8a430e1baf7bc6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 9 Jun 2013 22:35:10 +0200 Subject: [PATCH 62/85] 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 395ff22816..d64595e77a 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 = "2.6.5" +VERSION = "2.6.6" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From d2ad02c5ab121d9f4f0cc8c14084ffcce5baeabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Jun 2013 00:17:33 +0200 Subject: [PATCH 63/85] Fix domain concatenation between list and tuple (transplanted from 83a66e4ae380e5f2d790d1cd4c10a59a714fd6bd) --- trytond/model/modelstorage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index b6f1ccb35f..9bcbac2393 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -420,7 +420,7 @@ class ModelStorage(Model): if (rec_name not in cls._fields and rec_name not in cls._inherit_fields): return [] - return [(rec_name,) + clause[1:]] + return [(rec_name,) + tuple(clause[1:])] @classmethod def browse(cls, ids): From cca5a4444987726684182140a1ac5b7ea042ee8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 22 Jul 2013 11:47:08 +0200 Subject: [PATCH 64/85] Prepare release 2.6.6 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 358f843e9f..9f56a785c4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.6 - 2013-07-22 +* Bug fixes (see mercurial logs for details) + Version 2.6.5 - 2013-06-09 * Bug fixes (see mercurial logs for details) From 550a0ae92e9a73da5b9f36c234fd51c5ed716ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 22 Jul 2013 11:47:09 +0200 Subject: [PATCH 65/85] Added tag 2.6.6 for changeset 7f0124301dc3 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index effdc9644a..a9bc254a60 100644 --- a/.hgtags +++ b/.hgtags @@ -12,3 +12,4 @@ f607e7678c2c50271703e19c6bc51f60f91ecb4d 2.6.2 65f402c1c2334a2c804d4a69c5b84a42e722fc04 2.6.3 590e1cb0a933ec0afbcc8019db01a3f76620d1ae 2.6.4 0171fd1670c2ad463062a35466a1fde751e2ed57 2.6.5 +7f0124301dc3abf84a4cab6b4a2c2b77565e967d 2.6.6 From c4485e65a977cc673e07174629f4af71f6a8c0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 22 Jul 2013 11:47:46 +0200 Subject: [PATCH 66/85] 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 d64595e77a..e80852b65b 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 = "2.6.6" +VERSION = "2.6.7" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From cb6bf6f0ba54cfbf3546f8d9b8d9072294cfdbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 29 Jul 2013 10:32:45 +0200 Subject: [PATCH 67/85] Fix missing microseconds initialisation review1000002 (transplanted from 898b5745851610dd4ccd33fdc98a06c393669fc5) --- trytond/ir/trigger.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trytond/ir/trigger.py b/trytond/ir/trigger.py index 06032bf232..742bd9d3dc 100644 --- a/trytond/ir/trigger.py +++ b/trytond/ir/trigger.py @@ -212,6 +212,8 @@ class Trigger(ModelSQL, ModelView): timepart_full[0].split(":")) if len(timepart_full) == 2: microseconds = int(timepart_full[1]) + else: + microseconds = 0 delay[record_id] = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds) if (datetime.datetime.now() - delay[record_id] From 1fbad2b2842d20fd1718d9b7d42d9587fd0a1ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 1 Aug 2013 16:09:41 +0200 Subject: [PATCH 68/85] Remove validation of unused XML attributes Those XML attributes are no more allowed in XML. The domain is not only allowed in dashboard and it is not a field domain. issue3310 review986002 (transplanted from 4eba4934492ab6731626837e5bab3fb19f4cf053) --- trytond/ir/ui/view.py | 7 +------ trytond/model/modelview.py | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/trytond/ir/ui/view.py b/trytond/ir/ui/view.py index 9047a6e876..4f68a545c8 100644 --- a/trytond/ir/ui/view.py +++ b/trytond/ir/ui/view.py @@ -147,15 +147,10 @@ class View(ModelSQL, ModelView): # validate pyson attributes validates = { 'states': fields.states_validate, - 'domain': fields.domain_validate, - 'context': fields.context_validate, - 'digits': fields.digits_validate, - 'add_remove': fields.add_remove_validate, } def encode(element): - for attr in ('states', 'domain', 'context', 'digits', - 'add_remove', 'spell', 'colors'): + for attr in ('states', 'domain', 'spell', 'colors'): if element.get(attr): try: value = safe_eval(element.get(attr), CONTEXT) diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py index 8997f5d7e8..69aee4ff00 100644 --- a/trytond/model/modelview.py +++ b/trytond/model/modelview.py @@ -471,8 +471,7 @@ class ModelView(Model): # convert attributes into pyson encoder = PYSONEncoder() - for attr in ('states', 'domain', 'context', 'digits', 'add_remove', - 'spell', 'colors'): + for attr in ('states', 'domain', 'spell', 'colors'): if element.get(attr): element.set(attr, encoder.encode(safe_eval(element.get(attr), CONTEXT))) From 8f57943e86613bd373665a4904fae8032c66e6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 14 Aug 2013 11:31:39 +0200 Subject: [PATCH 69/85] Fix MySQL drop index query "ON" is required for MySQL (transplanted from 0204193c8ed628dbc48dec8d4ec001f66a00f1f8) --- trytond/backend/mysql/table.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trytond/backend/mysql/table.py b/trytond/backend/mysql/table.py index a579ac6871..7978cc0821 100644 --- a/trytond/backend/mysql/table.py +++ b/trytond/backend/mysql/table.py @@ -272,7 +272,8 @@ class TableHandler(TableHandlerInterface): return if index_name in self._indexes: - self.cursor.execute('DROP INDEX `%s` ' % (index_name,)) + self.cursor.execute('DROP INDEX `%s` ON `%s`' + % (index_name, self.table_name)) self._update_definitions() else: raise Exception('Index action not supported!') From 5639073a30ad137fcb6d008aeabe7990d725418e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 16 Aug 2013 11:07:44 +0200 Subject: [PATCH 70/85] Fix binary size handling migration to Active Record review1017002 (transplanted from 863dfb6f9a25e00ef711dee6de50e60b23664d59) --- trytond/model/fields/binary.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trytond/model/fields/binary.py b/trytond/model/fields/binary.py index a7283030f9..19f0cab791 100644 --- a/trytond/model/fields/binary.py +++ b/trytond/model/fields/binary.py @@ -43,7 +43,8 @@ class Binary(Field): res = {} converter = buffer default = False - format_ = Transaction().context.pop('%s.%s' % (model, name), '') + format_ = Transaction().context.pop('%s.%s' % (model.__name__, name), + '') if format_ == 'size': converter = len default = 0 From dc52536c1d6ec80b4e46b3cd270a06124d2ef989 Mon Sep 17 00:00:00 2001 From: Vishesh Yadav Date: Thu, 5 Sep 2013 01:59:22 +0530 Subject: [PATCH 71/85] Check if session exist when logging out. issue3344 review1040002 (transplanted from 3686ae05928cf0f8526c9eca4a377f8758d4ce46) --- trytond/security.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/trytond/security.py b/trytond/security.py index 14729bcbce..7455dfff7f 100644 --- a/trytond/security.py +++ b/trytond/security.py @@ -35,11 +35,14 @@ def logout(dbname, user, session): with Transaction().start(dbname, 0) as transaction: pool = _get_pool(dbname) Session = pool.get('ir.session') - session, = Session.search([ + sessions = Session.search([ ('key', '=', session), ]) + if not sessions: + return + session, = sessions name = session.create_uid.login - Session.delete([session]) + Session.delete(sessions) transaction.cursor.commit() return name From 4ceae7da968652e4963405fc8d0d8159cbabc86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 1 Oct 2013 21:50:27 +0200 Subject: [PATCH 72/85] Prepare release 2.6.7 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 9f56a785c4..18c70bb9ef 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.7 - 2013-10-01 +* Bug fixes (see mercurial logs for details) + Version 2.6.6 - 2013-07-22 * Bug fixes (see mercurial logs for details) From 131c0cdba0292a6af7b96a9cf4ec701447dfd523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 1 Oct 2013 21:50:28 +0200 Subject: [PATCH 73/85] Added tag 2.6.7 for changeset ad81a88a9afd --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a9bc254a60..67f4d39387 100644 --- a/.hgtags +++ b/.hgtags @@ -13,3 +13,4 @@ f607e7678c2c50271703e19c6bc51f60f91ecb4d 2.6.2 590e1cb0a933ec0afbcc8019db01a3f76620d1ae 2.6.4 0171fd1670c2ad463062a35466a1fde751e2ed57 2.6.5 7f0124301dc3abf84a4cab6b4a2c2b77565e967d 2.6.6 +ad81a88a9afddd695ebe453973dc4589428fa428 2.6.7 From c02cffa771b9b11debe453cb94d5b7299182b3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 1 Oct 2013 21:50:53 +0200 Subject: [PATCH 74/85] 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 e80852b65b..0434b1a98e 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 = "2.6.7" +VERSION = "2.6.8" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From a61aab86254eaa588c27a8e3820ce10cdd43bdfc Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Sat, 21 Sep 2013 00:34:15 +0200 Subject: [PATCH 75/85] Fix test for None error_args. issue3338 review1029002 (transplanted from 073147d17dc49d250f617025eb251951f214f7d0) --- trytond/error.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/error.py b/trytond/error.py index 33efe8e145..0f9ed1c0a2 100644 --- a/trytond/error.py +++ b/trytond/error.py @@ -38,7 +38,7 @@ class WarningErrorMixin(object): if res: error = res - if error_args: + if error_args is not None: try: error = error % error_args except TypeError: From e42e0e8e80c8ebc021bb41dd046a7384619a51cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 30 Sep 2013 18:18:24 +0200 Subject: [PATCH 76/85] Reference field should contain model in EvalEnvironment review1101002 (transplanted from bae54d7a20909a69c468f5520cdac47a6a3b00ab) --- trytond/model/modelstorage.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py index 9bcbac2393..7556f709e5 100644 --- a/trytond/model/modelstorage.py +++ b/trytond/model/modelstorage.py @@ -1374,6 +1374,8 @@ class EvalEnvironment(dict): or item in self._model._inherit_fields): value = getattr(self._record, item) if isinstance(value, Model): + if self._model._fields[item]._type == 'reference': + return str(value) return value.id elif isinstance(value, (list, tuple)): return [r.id for r in value] From c87651b4ef0938ce8753f38c6eef7d394d52b491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 5 Oct 2013 16:16:02 +0200 Subject: [PATCH 77/85] Fix domain concatenation between list and tuple issue3395 (transplanted from a8f3e29c5dbdf89b2f2f0a845e14e8663bd3a6af) --- trytond/ir/lang.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/ir/lang.py b/trytond/ir/lang.py index 881c47d048..56b4b414b3 100644 --- a/trytond/ir/lang.py +++ b/trytond/ir/lang.py @@ -62,9 +62,9 @@ class Lang(ModelSQL, ModelView): @classmethod def search_rec_name(cls, name, clause): - langs = cls.search([('code',) + clause[1:]], order=[]) + langs = cls.search([('code',) + tuple(clause[1:])], order=[]) if langs: - langs += cls.search([('name',) + clause[1:]], order=[]) + langs += cls.search([('name',) + tuple(clause[1:])], order=[]) return [('id', 'in', [l.id for l in langs])] return [('name',) + tuple(clause[1:])] From 035beb386756a54a39f7c8b4a86ae15cc9ef60e7 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 78/85] 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 7e80264bb1..0c4ebf1a9c 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -338,13 +338,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 27f465cdda26f78968cf9931198b59db7333ebf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 4 Dec 2013 17:27:09 +0100 Subject: [PATCH 79/85] Prepare release 2.6.8 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 18c70bb9ef..edff9da52e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.8 - 2013-12-04 +* Bug fixes (see mercurial logs for details) + Version 2.6.7 - 2013-10-01 * Bug fixes (see mercurial logs for details) From 2f1ecf9f38485dfa352860229b3d6b3dbacd95fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 4 Dec 2013 17:27:09 +0100 Subject: [PATCH 80/85] Added tag 2.6.8 for changeset 9830d53d3633 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 67f4d39387..16bf4ef61a 100644 --- a/.hgtags +++ b/.hgtags @@ -14,3 +14,4 @@ f607e7678c2c50271703e19c6bc51f60f91ecb4d 2.6.2 0171fd1670c2ad463062a35466a1fde751e2ed57 2.6.5 7f0124301dc3abf84a4cab6b4a2c2b77565e967d 2.6.6 ad81a88a9afddd695ebe453973dc4589428fa428 2.6.7 +9830d53d3633c627ea3f6b16f90ea69b5a9021bd 2.6.8 From f919fb063fb7ea9876181229d366dbc3c7c83fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 4 Dec 2013 17:27:34 +0100 Subject: [PATCH 81/85] 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 0434b1a98e..423f5b6931 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 = "2.6.8" +VERSION = "2.6.9" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From c209fdcc61e908f25726e6250a8b8745762410c1 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 82/85] 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 41df078d89..9d9b917352 100644 --- a/trytond/protocols/dispatcher.py +++ b/trytond/protocols/dispatcher.py @@ -147,18 +147,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 624485a61968a6a4f662d23e185d05b199aaf916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 18 Jan 2014 20:37:43 +0100 Subject: [PATCH 83/85] Prepare release 2.6.9 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index edff9da52e..000053c347 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.6.9 - 2014-01-18 +* Bug fixes (see mercurial logs for details) + Version 2.6.8 - 2013-12-04 * Bug fixes (see mercurial logs for details) From 80155525664bafa3befda3a09ce396ba55efb379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 18 Jan 2014 20:37:44 +0100 Subject: [PATCH 84/85] Added tag 2.6.9 for changeset 79fae0a8a699 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 16bf4ef61a..1887430a11 100644 --- a/.hgtags +++ b/.hgtags @@ -15,3 +15,4 @@ f607e7678c2c50271703e19c6bc51f60f91ecb4d 2.6.2 7f0124301dc3abf84a4cab6b4a2c2b77565e967d 2.6.6 ad81a88a9afddd695ebe453973dc4589428fa428 2.6.7 9830d53d3633c627ea3f6b16f90ea69b5a9021bd 2.6.8 +79fae0a8a699328ffbc56a4b6ad7493f3d72bff8 2.6.9 From 0c7760589621f15f4581cc401dfbbf099d411890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 18 Jan 2014 20:38:11 +0100 Subject: [PATCH 85/85] 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 423f5b6931..ad3283c236 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 = "2.6.9" +VERSION = "2.6.10" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/"