From 158555d7d3862cb789e8bd7d70e8a85ea0b5fb95 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Mon, 6 Jul 2020 16:07:38 +0200 Subject: [PATCH] WIP TemplateTool: draft bt5 crashes --- product/ERP5/Tool/TemplateTool.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/product/ERP5/Tool/TemplateTool.py b/product/ERP5/Tool/TemplateTool.py index 63dc275329..1794586046 100644 --- a/product/ERP5/Tool/TemplateTool.py +++ b/product/ERP5/Tool/TemplateTool.py @@ -133,13 +133,17 @@ class TemplateTool (BaseTool): if state == 'installed': return bt if state == 'not_installed': - last_transition = bt.workflow_history \ - ['business_template_installation_workflow'][-1] - if last_transition['action'] == 'uninstall': # There is not uninstalled state ! - t = last_transition['time'] - if last_time < t: - last_bt = None - last_time = t + try: + last_transition = bt.workflow_history \ + ['business_template_installation_workflow'][-1] + except TypeError: + continue + else: + if last_transition['action'] == 'uninstall': # There is not uninstalled state ! + t = last_transition['time'] + if last_time < t: + last_bt = None + last_time = t elif state == 'replaced' and not strict: t = bt.workflow_history \ ['business_template_installation_workflow'][-1]['time'] -- 2.30.9