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
2f1297da
Commit
2f1297da
authored
Jun 14, 2019
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Configurator: add check consistency command just to checkconsistency instead of fix
parent
2773e300
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
product/ERP5Configurator/Document/BusinessConfiguration.py
product/ERP5Configurator/Document/BusinessConfiguration.py
+41
-0
product/ERP5Configurator/Tool/ConfiguratorTool.py
product/ERP5Configurator/Tool/ConfiguratorTool.py
+21
-0
No files found.
product/ERP5Configurator/Document/BusinessConfiguration.py
View file @
2f1297da
...
...
@@ -39,6 +39,7 @@ from Products.ERP5.Document.Item import Item
INITIAL_STATE_TITLE
=
'Start'
DOWNLOAD_STATE_TITLE
=
'Download'
END_STATE_TITLE
=
'End'
CHECK_CONSISTENCY_STATE_TITLE
=
'Consistency'
class
BusinessConfiguration
(
Item
):
"""
...
...
@@ -87,6 +88,12 @@ class BusinessConfiguration(Item):
"""
return
self
.
getCurrentStateTitle
()
==
END_STATE_TITLE
security
.
declareProtected
(
Permissions
.
View
,
'isCheckConsistencyConfigurationState'
)
def
isCheckConsistencyConfigurationState
(
self
):
""" Check if the Business Configuration is on check consistency State
"""
return
self
.
getCurrentStateTitle
()
==
CHECK_CONSISTENCY_STATE_TITLE
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
\
'initializeWorkflow'
)
def
initializeWorkflow
(
self
):
...
...
@@ -166,6 +173,11 @@ class BusinessConfiguration(Item):
self
.
_executeTransition
()
transition
=
self
.
getNextTransition
()
return
None
,
None
,
None
,
None
elif
self
.
isCheckConsistencyConfigurationState
():
## exec next transition for this business configuration
self
.
_executeTransition
()
transition
=
self
.
getNextTransition
()
return
None
,
'check consistency'
,
None
,
None
if
form_id
is
None
:
## go on until you find a form
self
.
_executeTransition
()
...
...
@@ -358,3 +370,32 @@ 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
,
'checkConsistency'
)
def
checkConsistency
(
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
())
if
self
.
portal_workflow
.
isTransitionPossible
(
self
,
'install'
):
self
.
activate
(
after_tag
=
kw
[
"tag"
]).
install
()
\ No newline at end of file
product/ERP5Configurator/Tool/ConfiguratorTool.py
View file @
2f1297da
...
...
@@ -137,6 +137,8 @@ class ConfiguratorTool(BaseTool):
next
=
response
[
'next'
])
elif
response
[
"command"
]
==
"install"
:
return
self
.
startInstallation
(
bc
,
REQUEST
=
REQUEST
)
elif
response
[
"command"
]
==
"check consistency"
:
return
self
.
startCheckConsistency
(
bc
,
REQUEST
=
REQUEST
)
def
_next
(
self
,
business_configuration
,
kw
):
""" Return next configuration form and validate previous. """
...
...
@@ -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 consistency'
:
response
.
update
(
command
=
"check consistency"
,
data
=
None
)
else
:
## we have more forms
next_state
=
self
.
restrictedTraverse
(
business_configuration
.
getNextTransition
()
\
...
...
@@ -361,3 +365,20 @@ class ConfiguratorTool(BaseTool):
active_process
=
active_process
,
tag
=
'initialERP5Setup'
).
build
()
return
self
.
ConfiguratorTool_viewInstallationStatus
(
REQUEST
)
def
startCheckConsistency
(
self
,
business_configuration
,
REQUEST
):
""" Start installation process as an activity which will
download/install bt5 template files and meanwhile offer
user a nice GUI to observe what's happening. """
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'
).
checkConsistency
()
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