From ce213537c2ee4e56caec3ec4ee38b7c1c7cc4408 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Fri, 4 Feb 2005 15:46:19 +0000
Subject: [PATCH] newCellContent should support a portal_type

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2410 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/XMLMatrix.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/product/ERP5Type/XMLMatrix.py b/product/ERP5Type/XMLMatrix.py
index aaa9603429..4e886b2425 100755
--- a/product/ERP5Type/XMLMatrix.py
+++ b/product/ERP5Type/XMLMatrix.py
@@ -461,18 +461,21 @@ class XMLMatrix(Folder):
       if cell is not None:
         return cell
       else:
-        return self.newCellContent(cell_id)
+        return self.newCellContent(cell_id,**kwd)
 
     security.declareProtected( Permissions.ModifyPortalContent, 'newCellContent' )
-    def newCellContent(self, id):
+    def newCellContent(self, id,**kw):
       """
           This method can be overriden
       """
-      content_types = self.allowedContentTypes()
-      if len(content_types) >= 1:
-        type_name = content_types[0].id
+      if kw.has_key('portal_type'):
+        type_name = kw['portal_type']
       else:
-        type_name = self.portal_type
+        content_types = self.allowedContentTypes()
+        if len(content_types) >= 1:
+          type_name = content_types[0].id
+        else:
+          type_name = self.portal_type
       self.invokeFactory(type_name=type_name,id=id)
       return self.get(id)
 
-- 
2.30.9