Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
a8a99aee
Commit
a8a99aee
authored
Jun 14, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Configurator: add check existing site action to verify consistency
parent
2773e300
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
product/ERP5Configurator/Document/BusinessConfiguration.py
product/ERP5Configurator/Document/BusinessConfiguration.py
+40
-0
product/ERP5Configurator/Tool/ConfiguratorTool.py
product/ERP5Configurator/Tool/ConfiguratorTool.py
+18
-1
No files found.
product/ERP5Configurator/Document/BusinessConfiguration.py
View file @
a8a99aee
...
...
@@ -35,10 +35,12 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5Configurator.Tool.ConfiguratorTool
import
_validateFormToRequest
from
Products.ERP5.Document.Item
import
Item
## Workflow states definitions
INITIAL_STATE_TITLE
=
'Start'
DOWNLOAD_STATE_TITLE
=
'Download'
END_STATE_TITLE
=
'End'
CHECK_EXISTING_SITE_STATE_TITLE
=
'Check Existing Site'
class
BusinessConfiguration
(
Item
):
"""
...
...
@@ -87,6 +89,12 @@ class BusinessConfiguration(Item):
"""
return
self
.
getCurrentStateTitle
()
==
END_STATE_TITLE
security
.
declareProtected
(
Permissions
.
View
,
'isCheckExistingSiteConfigurationState'
)
def
isCheckExistingSiteConfigurationState
(
self
):
""" Check if the Business Configuration is on check existing site State
"""
return
self
.
getCurrentStateTitle
()
==
CHECK_EXISTING_SITE_STATE_TITLE
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
\
'initializeWorkflow'
)
def
initializeWorkflow
(
self
):
...
...
@@ -166,6 +174,11 @@ class BusinessConfiguration(Item):
self
.
_executeTransition
()
transition
=
self
.
getNextTransition
()
return
None
,
None
,
None
,
None
elif
self
.
isCheckExistingSiteConfigurationState
():
## exec next transition for this business configuration
self
.
_executeTransition
()
transition
=
self
.
getNextTransition
()
return
None
,
'check existing site'
,
None
,
None
if
form_id
is
None
:
## go on until you find a form
self
.
_executeTransition
()
...
...
@@ -358,3 +371,30 @@ class BusinessConfiguration(Item):
if
self
.
portal_workflow
.
isTransitionPossible
(
self
,
'install'
):
self
.
activate
(
after_tag
=
kw
[
"tag"
]).
install
()
############# Instance and Business Configuration ########################
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'checkExistingSite'
)
def
checkExistingSite
(
self
):
"""
Build list of business templates according to already saved
Configuration Saves (i.e. user input).
This is the actual implementation which can be used from workflow
actions and Configurator requets
"""
kw
=
dict
(
tag
=
"start_configuration_%s"
%
self
.
getId
(),
after_method_id
=
[
"updateBusinessTemplateFromUrl"
,
"immediateReindexObject"
])
# build
configuration_save_list
=
self
.
contentValues
(
portal_type
=
'Configuration Save'
)
configuration_save_list
.
sort
(
lambda
x
,
y
:
cmp
(
x
.
getIntIndex
(
x
.
getIntId
()),
y
.
getIntIndex
(
y
.
getIntId
())))
for
configuration_save
in
configuration_save_list
:
# XXX: check which items are configure-able
configuration_item_list
=
configuration_save
.
contentValues
()
configuration_item_list
.
sort
(
lambda
x
,
y
:
cmp
(
x
.
getIntId
(),
y
.
getIntId
()))
for
configurator_item
in
configuration_item_list
:
configurator_item
.
activate
(
**
kw
).
checkConsistency
(
filter
=
{
"constraint_type"
:
"configuration"
})
kw
[
"after_tag"
]
=
kw
[
"tag"
]
kw
[
"tag"
]
=
"configurator_item_%s_%s"
%
(
configurator_item
.
getId
(),
configurator_item
.
getUid
())
product/ERP5Configurator/Tool/ConfiguratorTool.py
View file @
a8a99aee
...
...
@@ -38,6 +38,7 @@ from Products.ERP5Configurator import _dtmldir
from
Products.Formulator.Errors
import
FormValidationError
from
DateTime
import
DateTime
referer
=
None
installation_status
=
{
'bt5'
:
{
'current'
:
0
,
'all'
:
0
,
},
...
...
@@ -137,6 +138,8 @@ class ConfiguratorTool(BaseTool):
next
=
response
[
'next'
])
elif
response
[
"command"
]
==
"install"
:
return
self
.
startInstallation
(
bc
,
REQUEST
=
REQUEST
)
elif
response
[
"command"
]
==
"check existing site"
:
return
self
.
startCheckExistingSite
(
bc
,
REQUEST
=
REQUEST
)
def
_next
(
self
,
business_configuration
,
kw
):
""" Return next configuration form and validate previous. """
...
...
@@ -144,7 +147,6 @@ class ConfiguratorTool(BaseTool):
need_validation
=
1
validation_errors
=
None
response
=
{}
business_configuration
.
initializeWorkflow
()
## initial state no previous form to validate
...
...
@@ -266,6 +268,8 @@ class ConfiguratorTool(BaseTool):
if
html
is
None
:
## we have no more forms proceed to build
response
.
update
(
command
=
"install"
,
data
=
None
)
elif
html
==
'check existing site'
:
response
.
update
(
command
=
"check existing site"
,
data
=
None
)
else
:
## we have more forms
next_state
=
self
.
restrictedTraverse
(
business_configuration
.
getNextTransition
()
\
...
...
@@ -361,3 +365,16 @@ class ConfiguratorTool(BaseTool):
active_process
=
active_process
,
tag
=
'initialERP5Setup'
).
build
()
return
self
.
ConfiguratorTool_viewInstallationStatus
(
REQUEST
)
def
startCheckExistingSite
(
self
,
business_configuration
,
REQUEST
):
global
installation_status
# init installation status
installation_status
[
'bt5'
][
'all'
]
=
1
installation_status
[
'bt5'
][
'current'
]
=
0
installation_status
[
'activity_list'
]
=
[]
active_process
=
self
.
portal_activities
.
newActiveProcess
()
REQUEST
.
set
(
'active_process_id'
,
active_process
.
getId
())
business_configuration
.
activate
(
active_process
=
active_process
,
tag
=
'initialERP5Setup'
).
checkExistingSite
()
return
self
.
ConfiguratorTool_viewInstallationStatus
(
REQUEST
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment