From 8cc2ef256c373d4d4b81fd8295e5e3231b75e360 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Thu, 3 Jun 2010 13:57:58 +0000
Subject: [PATCH] instance.getPortalObject() raises AttributeError if instance
 is just created by manage_pasteObject().

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35954 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Base.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py
index d798e08fd9..167275749c 100644
--- a/product/ERP5Type/Base.py
+++ b/product/ERP5Type/Base.py
@@ -168,7 +168,10 @@ class WorkflowMethod(Method):
 
     # New implementation does not use any longer wrapWorkflowMethod
     # but directly calls the workflow methods
-    wf = getToolByName(instance.getPortalObject(), 'portal_workflow', None)
+    try:
+      wf = getToolByName(instance.getPortalObject(), 'portal_workflow', None)
+    except AttributeError:
+      wf = getToolByName(instance, 'portal_workflow', None)
 
     if wf is None:
       # XXX instance is unwrapped(no acquisition)
-- 
2.30.9