diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index 275e95f0851ad4b08bd031ba71bb6b29140f3870..f21dbe012851cbdb8ed7430607bf765d695f992b 100755 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -78,6 +78,12 @@ class ObjectTemplateItem(Implicit): container._importObjectFromFile(cStringIO.StringIO(self.export_string)) #else: # container._importObjectFromFile(cStringIO.StringIO(self.export_string)) + ob = container[object_id] + if ob.meta_type in ('Z SQL Method',): + # It is necessary to make sure that the sql connection in this method is valid. + sql_connection_list = portal.objectIds(spec=('Z MySQL Database Connection',)) + if ob.connection_id not in sql_connection_list: + ob.connection_id = sql_connection_list[0] class PortalTypeTemplateItem(Implicit): """