From 74d8ea6399ff58da193f3c124ebbd8444afd5839 Mon Sep 17 00:00:00 2001
From: Leonardo Rochael Almeida <leonardo@nexedi.com>
Date: Wed, 21 Oct 2009 15:03:36 +0000
Subject: [PATCH] BusinessTemplates now store actions into the action_tool when
 the original destination is no longer an IActionProvider (approved by jm)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29885 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 0c5480a7b9..45abab9b2f 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -2446,6 +2446,16 @@ class ActionTemplateItem(ObjectTemplateItem):
 
           # Following code is for actions outside Types Tool.
           # It will be removed when they are also converted to ERP5 actions.
+          from Products.CMFCore.interfaces import IActionProvider
+          if not IActionProvider.providedBy(container):
+            # some tools stopped being ActionProviders in CMF 2.x. Drop the
+            # action into portal_actions.
+            LOG('Products.ERP5.Document.BusinessTemplate', WARNING,
+                'Misplaced action',
+                'Attempted to store action %r in %r which is no longer an '
+                'IActionProvided. Storing action on portal_actions instead' %
+                (id, path))
+            container = p.portal_actions
           obj, action = container, obj
           action_list = obj.listActions()
           for index in range(len(action_list)):
-- 
2.30.9