From 7f8f0d569e9b5b83aba06460cb4c9f48b68db3fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 16 Nov 2008 14:32:40 +0100 Subject: [PATCH] Fix clean error message translation from wizard --- trytond/ir/translation.py | 25 ++++++++++++++++--------- trytond/wizard/wizard.py | 3 +++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py index 3233e1996a..77253cb437 100644 --- a/trytond/ir/translation.py +++ b/trytond/ir/translation.py @@ -806,15 +806,22 @@ class TranslationClean(Wizard): 'required_validation_record', ): continue - if model_name not in self.pool.object_name_list(): - to_delete.append(translation.id) - continue - model_obj = self.pool.get(model_name) - errors = model_obj._error_messages.values() + \ - model_obj._sql_error_messages.values() - for _, _, error in model_obj._sql_constraints: - errors.append(error) - if translation.src not in errors: + if model_name in self.pool.object_name_list(): + model_obj = self.pool.get(model_name) + errors = model_obj._error_messages.values() + \ + model_obj._sql_error_messages.values() + for _, _, error in model_obj._sql_constraints: + errors.append(error) + if translation.src not in errors: + to_delete.append(translation.id) + continue + elif model_name in pool_wizard.object_name_list(): + wizard_obj = pool_wizard.get(model_name) + errors = wizard_obj._error_messages.values() + if translation.src not in errors: + to_delete.append(translation.id) + continue + else: to_delete.append(translation.id) continue # skip translation handled in ir.model.data diff --git a/trytond/wizard/wizard.py b/trytond/wizard/wizard.py index fabffd22b2..2c09d886d0 100644 --- a/trytond/wizard/wizard.py +++ b/trytond/wizard/wizard.py @@ -81,6 +81,9 @@ class WizardService(Service): cursor.close() return res + def object_name_list(self): + return self.object_name_pool.keys() + def add(self, name, object_name_inst): """ adds a new obj instance to the obj pool.