Commit 9f829522 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Add constructor method for adding ERP5 SQL Method objects

parent afc2e4d2
......@@ -35,14 +35,31 @@ from Products.ERP5Type.XMLObject import XMLObject
from Products.PythonScripts.PythonScript import \
PythonScript as ZopePythonScript
from Products.ZSQLMethods.SQL import SQL as ZSQL
from Products.ZSQLMethods.SQL import manage_addZSQLMethodForm
# Migration function
def migrateSQLMethodToERP5Object(self, id, title=''):
pass
manage_addSQLMethodForm = manage_addZSQLMethodForm
# New ZSQLMethod addition function
def addSQLMethod(self, id, title=''):
pass
def addSQLMethod(self, id, title='',
REQUEST=None,
*args,
**kw):
"""
Add ERP5 SQL Method to the folder
"""
id = str(id)
title = str(title)
c = SQLMethod(id, title, self)
self._setObject(id, c)
c = self._getOb(id)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect( 'manage_main' )
return c
class SQLMethod(XMLObject, ZSQL):
"""SQLMethod for ERP5.
......@@ -50,11 +67,13 @@ class SQLMethod(XMLObject, ZSQL):
meta_type = 'ERP5 SQL Method'
portal_type = 'SQL Method'
icon = None
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
constructors = (manage_addSQLMethodForm, addSQLMethod)
#View content list, Force /view, Standart option in python scripts
manage_options = ( XMLObject.manage_options[0],
{'icon':'', 'label':'View','action':'view'}) \
......@@ -75,4 +94,4 @@ class SQLMethod(XMLObject, ZSQL):
XMLObject.__init__(self, *args, **kw)
ZSQL.__init__(self, *args, **kw)
InitializeClass(SQLMethod)
\ No newline at end of file
#InitializeClass(SQLMethod)
\ No newline at end of file
......@@ -53,9 +53,10 @@ from Tool import CategoryTool, SimulationTool, RuleTool, IdTool, TemplateTool,\
ConversionTool, RoundingTool, UrlRegistryTool, InterfaceTool,\
CertificateAuthorityTool, InotifyTool, TaskDistributionTool
import ERP5Site
from Document import PythonScript
from Document import PythonScript, SQLMethod
object_classes = ( ERP5Site.ERP5Site,
PythonScript.PythonScriptThroughZMI,
SQLMethod.SQLMethod,
)
portal_tools = ( CategoryTool.CategoryTool,
SimulationTool.SimulationTool,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment