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
Labels
Merge Requests
138
Merge Requests
138
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
a0dfb228
Commit
a0dfb228
authored
Nov 08, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into zope4py2
parents
f1216db4
164e4631
Pipeline
#24625
failed with stage
in 0 seconds
Changes
26
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
498 additions
and
460 deletions
+498
-460
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/account_cache_interaction_workflow/script_Account_flushAccountListCacheIfAccountIsValidated.py
...ript_Account_flushAccountListCacheIfAccountIsValidated.py
+1
-1
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/script_validateTransactionLines.py
...ow/accounting_workflow/script_validateTransactionLines.py
+1
-1
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_guessGroupingReference.py
...tion_simulation_workflow/script_guessGroupingReference.py
+1
-1
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_initialiseMirrorAccountingAndSetReferences.py
...flow/script_initialiseMirrorAccountingAndSetReferences.py
+1
-1
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_resetGroupingReference.py
...tion_simulation_workflow/script_resetGroupingReference.py
+1
-1
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_setReferences.py
...e_transaction_simulation_workflow/script_setReferences.py
+1
-1
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_validateTransaction.py
...saction_simulation_workflow/script_validateTransaction.py
+1
-1
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_validateTransactionLines.py
...on_simulation_workflow/script_validateTransactionLines.py
+1
-1
bt5/erp5_apparel/DocumentTemplateItem/portal_components/document.erp5.ApparelMeasurement.py
...tem/portal_components/document.erp5.ApparelMeasurement.py
+2
-2
bt5/erp5_base/WorkflowTemplateItem/portal_workflow/delivery_movement_simulation_interaction_workflow/script_DeliveryMovement_unlinkSimulation.py
...tion_workflow/script_DeliveryMovement_unlinkSimulation.py
+1
-1
bt5/erp5_certificate_authority/TestTemplateItem/portal_components/test.erp5_certificate_authority.testCertificateAuthorityTool.py
...rp5_certificate_authority.testCertificateAuthorityTool.py
+1
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
.../TestTemplateItem/portal_components/test.erp5.testBase.py
+26
-22
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+10
-5
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testInteractionWorkflow.py
...em/portal_components/test.erp5.testInteractionWorkflow.py
+163
-150
bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/script_Event_checkConsistencyForAcknowledge.py
...t_workflow/script_Event_checkConsistencyForAcknowledge.py
+1
-1
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
...ort_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
+2
-2
bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_workflow/script_TestResult_fail.py
...l_workflow/test_result_workflow/script_TestResult_fail.py
+1
-1
bt5/erp5_travel_expense/WorkflowTemplateItem/portal_workflow/ticket_record_interaction_workflow/script_Ticket_updateRecord.py
...record_interaction_workflow/script_Ticket_updateRecord.py
+3
-3
product/ERP5Type/Base.py
product/ERP5Type/Base.py
+5
-1
product/ERP5Type/Tool/WorkflowTool.py
product/ERP5Type/Tool/WorkflowTool.py
+12
-6
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+2
-4
product/ERP5Type/patches/StateChangeInfoPatch.py
product/ERP5Type/patches/StateChangeInfoPatch.py
+0
-1
product/ERP5Type/patches/WorkflowTool.py
product/ERP5Type/patches/WorkflowTool.py
+250
-249
product/ERP5Type/tests/SecurityTestCase.py
product/ERP5Type/tests/SecurityTestCase.py
+0
-1
product/ERP5Type/tests/testERP5NamingConvention.py
product/ERP5Type/tests/testERP5NamingConvention.py
+3
-2
product/ERP5Type/tests/testUpgradeInstanceWithOldDataFs.py
product/ERP5Type/tests/testUpgradeInstanceWithOldDataFs.py
+8
-0
No files found.
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/account_cache_interaction_workflow/script_Account_flushAccountListCacheIfAccountIsValidated.py
View file @
a0dfb228
...
...
@@ -2,4 +2,4 @@
because only validated accounts are displayed in the cache.
"""
if
sci
[
'object'
].
getValidationState
()
==
'validated'
:
container
.
Account_flushAccountListCache
(
sci
)
container
.
script_
Account_flushAccountListCache
(
sci
)
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/accounting_workflow/script_validateTransactionLines.py
View file @
a0dfb228
...
...
@@ -13,7 +13,7 @@ section_portal_type_list = ['Person', 'Organisation']
invalid_state_list
=
[
'invalidated'
,
'deleted'
]
# first of all, validate the transaction itself
container
.
validateTransaction
(
state_change
)
container
.
script_
validateTransaction
(
state_change
)
# Check that all lines uses open accounts, and doesn't use invalid third
...
...
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_guessGroupingReference.py
View file @
a0dfb228
return
sci
.
getPortal
().
portal_workflow
.
accounting_workflow
.
scripts
[
script
.
getId
()](
sci
)
return
sci
.
getPortal
().
portal_workflow
.
accounting_workflow
[
script
.
getId
()](
sci
)
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_initialiseMirrorAccountingAndSetReferences.py
View file @
a0dfb228
state_change
[
'object'
].
AccountingTransaction_setDefaultMirrorAccountList
()
return
container
.
setReferences
(
state_change
)
return
container
.
s
cript_s
etReferences
(
state_change
)
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_resetGroupingReference.py
View file @
a0dfb228
return
sci
.
getPortal
().
portal_workflow
.
accounting_workflow
.
scripts
[
script
.
getId
()](
sci
)
return
sci
.
getPortal
().
portal_workflow
.
accounting_workflow
[
script
.
getId
()](
sci
)
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_setReferences.py
View file @
a0dfb228
return
state_change
.
getPortal
().
portal_workflow
.
accounting_workflow
.
scripts
[
script
.
getId
()](
state_change
)
return
state_change
.
getPortal
().
portal_workflow
.
accounting_workflow
[
script
.
getId
()](
state_change
)
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_validateTransaction.py
View file @
a0dfb228
return
state_change
.
getPortal
().
portal_workflow
.
accounting_workflow
.
scripts
[
script
.
getId
()](
state_change
)
return
state_change
.
getPortal
().
portal_workflow
.
accounting_workflow
[
script
.
getId
()](
state_change
)
bt5/erp5_accounting/WorkflowTemplateItem/portal_workflow/internal_invoice_transaction_simulation_workflow/script_validateTransactionLines.py
View file @
a0dfb228
...
...
@@ -7,4 +7,4 @@ if old_state.getId() == 'draft':
if
internal_invoice
.
InternalInvoiceTransaction_getAuthenticatedUserSection
()
==
internal_invoice
.
getDestinationSection
():
raise
ValidationFailed
(
translateString
(
"Your entity should not be destination."
))
return
state_change
.
getPortal
().
portal_workflow
.
accounting_workflow
.
scripts
[
script
.
getId
()](
state_change
)
return
state_change
.
getPortal
().
portal_workflow
.
accounting_workflow
[
script
.
getId
()](
state_change
)
bt5/erp5_apparel/DocumentTemplateItem/portal_components/document.erp5.ApparelMeasurement.py
View file @
a0dfb228
...
...
@@ -29,7 +29,7 @@
##############################################################################
from
AccessControl
import
ClassSecurityInfo
from
Products.
CMFCore.WorkflowCore
import
WorkflowAction
from
Products.
ERP5Type.Base
import
WorkflowMethod
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.XMLObject
import
XMLObject
...
...
@@ -64,7 +64,7 @@ class ApparelMeasurement(XMLObject, XMLMatrix, Image):
# Inheritance
_edit
=
Image
.
_edit
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'edit'
)
edit
=
Workflow
Action
(
_edit
)
edit
=
Workflow
Method
(
_edit
)
security
.
declareProtected
(
Permissions
.
View
,
'index_html'
)
index_html
=
Image
.
index_html
...
...
bt5/erp5_base/WorkflowTemplateItem/portal_workflow/delivery_movement_simulation_interaction_workflow/script_DeliveryMovement_unlinkSimulation.py
View file @
a0dfb228
...
...
@@ -24,4 +24,4 @@ for simulation_movement in simulation_movement_list:
if
simulation_movement
.
getOrder
()
==
delivery_movement
.
getRelativeUrl
():
simulation_movement
.
setOrder
(
None
)
cont
ext
.
DeliveryMovement_updateSimulation
(
state_change
)
cont
ainer
.
script_
DeliveryMovement_updateSimulation
(
state_change
)
bt5/erp5_certificate_authority/TestTemplateItem/portal_components/test.erp5_certificate_authority.testCertificateAuthorityTool.py
View file @
a0dfb228
...
...
@@ -31,7 +31,7 @@ import os
import
random
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.
DCWorkflow.DC
Workflow
import
ValidationFailed
from
Products.
ERP5Type.Core.
Workflow
import
ValidationFailed
from
AccessControl
import
Unauthorized
class
TestCertificateAuthority
(
ERP5TypeTestCase
):
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
View file @
a0dfb228
...
...
@@ -966,19 +966,23 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
# Add a non-existent workflow.
pw
=
self
.
getWorkflowTool
()
dummy_simulation_wor
l
flow_id
=
'fake_simulation_workflow'
dummy_validation_wor
l
flow_id
=
'fake_validation_workflow'
dummy_simulation_wor
k
flow_id
=
'fake_simulation_workflow'
dummy_validation_wor
k
flow_id
=
'fake_validation_workflow'
#Assume that erp5_styles workflow Manage permissions with acquired Role by default
addWorkflowByType
(
pw
,
'erp5_workflow'
,
dummy_simulation_worlflow_id
)
addWorkflowByType
(
pw
,
'erp5_workflow'
,
dummy_validation_worlflow_id
)
dummy_simulation_worlflow
=
pw
[
dummy_simulation_worlflow_id
]
dummy_validation_worlflow
=
pw
[
dummy_validation_worlflow_id
]
dummy_validation_worlflow
.
variables
.
setStateVar
(
'validation_state'
)
dummy_simulation_workflow
=
pw
.
newContent
(
portal_type
=
'Workflow'
,
reference
=
dummy_simulation_workflow_id
,
)
dummy_validation_workflow
=
pw
.
newContent
(
portal_type
=
'Workflow'
,
reference
=
dummy_validation_workflow_id
,
state_variable
=
'validation_state'
,
)
organisation_type
=
portal
.
portal_types
.
getTypeInfo
(
portal_type
)
organisation_initial_workflow_list
=
organisation_type
.
getTypeWorkflowList
()
organisation_type
.
setTypeWorkflowList
([
dummy_validation_wor
l
flow_id
,
dummy_simulation_wor
l
flow_id
])
permission_list
=
list
(
dummy_simulation_worlflow
.
permissions
)
organisation_type
.
setTypeWorkflowList
([
dummy_validation_wor
k
flow_id
,
dummy_simulation_wor
k
flow_id
])
permission_list
=
dummy_simulation_workflow
.
getWorkflowManagedPermissionList
(
)
manager_has_permission
=
{}
for
permission
in
permission_list
:
manager_has_permission
[
permission
]
=
(
'Manager'
,)
...
...
@@ -989,7 +993,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
user
=
getSecurityManager
().
getUser
()
try
:
self
.
assertTrue
(
permission_list
)
self
.
assertFalse
(
dummy_simulation_wor
lflow
.
states
.
draft
.
permission_roles
)
self
.
assertFalse
(
dummy_simulation_wor
kflow
[
'state_draft'
].
getStatePermissionRoleListDict
()
)
#1
obj
=
module
.
newContent
(
portal_type
=
portal_type
)
#No role is defined by default on workflow
...
...
@@ -999,28 +1003,28 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
for
permission
in
permission_list
:
self
.
assertTrue
(
user
.
has_permission
(
permission
,
obj
))
#2 Now configure both workflow with same configuration
dummy_simulation_wor
lflow
.
states
.
draft
.
permission_roles
=
manager_has_permission
.
copy
(
)
dummy_validation_wor
lflow
.
states
.
draft
.
permission_roles
=
manager_has_permission
.
copy
(
)
dummy_simulation_wor
l
flow
.
updateRoleMappingsFor
(
obj
)
dummy_validation_wor
l
flow
.
updateRoleMappingsFor
(
obj
)
dummy_simulation_wor
kflow
[
'state_draft'
].
setStatePermissionRoleListDict
(
manager_has_permission
.
copy
()
)
dummy_validation_wor
kflow
[
'state_draft'
].
setStatePermissionRoleListDict
(
manager_has_permission
.
copy
()
)
dummy_simulation_wor
k
flow
.
updateRoleMappingsFor
(
obj
)
dummy_validation_wor
k
flow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertTrue
(
user
.
has_permission
(
permission
,
obj
))
#3 change only dummy_simulation_wor
l
flow
dummy_simulation_wor
lflow
.
states
.
draft
.
permission_roles
=
manager_has_no_permission
.
copy
(
)
dummy_simulation_wor
l
flow
.
updateRoleMappingsFor
(
obj
)
#3 change only dummy_simulation_wor
k
flow
dummy_simulation_wor
kflow
[
'state_draft'
].
setStatePermissionRoleListDict
(
manager_has_no_permission
.
copy
()
)
dummy_simulation_wor
k
flow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertFalse
(
user
.
has_permission
(
permission
,
obj
))
#4 enable acquisition for dummy_simulation_wor
l
flow
dummy_simulation_wor
lflow
.
states
.
draft
.
permission_roles
=
None
dummy_simulation_wor
l
flow
.
updateRoleMappingsFor
(
obj
)
#4 enable acquisition for dummy_simulation_wor
k
flow
dummy_simulation_wor
kflow
[
'state_draft'
].
setAcquirePermissionList
(
permission_list
)
dummy_simulation_wor
k
flow
.
updateRoleMappingsFor
(
obj
)
for
permission
in
permission_list
:
self
.
assertTrue
(
user
.
has_permission
(
permission
,
obj
))
finally
:
# Make sure that the artificial workflow is not referred to any longer.
organisation_type
.
setTypeWorkflowList
(
organisation_initial_workflow_list
)
pw
.
manage_delObjects
([
dummy_simulation_wor
lflow_id
,
dummy_validation_worl
flow_id
])
pw
.
manage_delObjects
([
dummy_simulation_wor
kflow_id
,
dummy_validation_work
flow_id
])
def
test_getViewPermissionOwnerDefault
(
self
):
"""Test getViewPermissionOwner method behaviour"""
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
a0dfb228
...
...
@@ -39,7 +39,6 @@ from urllib import pathname2url
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.dynamic.lazy_class
import
ERP5BaseBroken
from
Products.ERP5Type.tests.utils
import
LogInterceptor
from
Products.ERP5Type.Workflow
import
addWorkflowByType
import
shutil
import
os
import
random
...
...
@@ -1315,8 +1314,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
wf_id
=
'geek_workflow'
pw
=
self
.
getWorkflowTool
()
addWorkflowByType
(
pw
,
WORKFLOW_TYPE
,
wf_id
)
workflow
=
pw
.
_getOb
(
wf_id
,
None
)
workflow
=
pw
.
newContent
(
portal_type
=
'Workflow'
,
reference
=
wf_id
,
)
self
.
tic
()
self
.
assertTrue
(
workflow
is
not
None
)
sequence
.
edit
(
workflow_id
=
workflow
.
getId
())
...
...
@@ -2886,8 +2888,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
wf_id
=
'custom_geek_workflow'
pw
=
self
.
getWorkflowTool
()
addWorkflowByType
(
pw
,
WORKFLOW_TYPE
,
wf_id
)
workflow
=
pw
.
_getOb
(
wf_id
,
None
)
workflow
=
pw
.
newContent
(
portal_type
=
'Workflow'
,
reference
=
wf_id
,
)
self
.
tic
()
self
.
assertTrue
(
workflow
is
not
None
)
sequence
.
edit
(
workflow_id
=
workflow
.
getId
())
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testInteractionWorkflow.py
View file @
a0dfb228
This diff is collapsed.
Click to expand it.
bt5/erp5_crm/WorkflowTemplateItem/portal_workflow/event_workflow/script_Event_checkConsistencyForAcknowledge.py
View file @
a0dfb228
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Message
import
translateString
container
.
Event_checkConsistency
(
sci
)
container
.
script_
Event_checkConsistency
(
sci
)
portal
=
sci
.
getPortal
()
portal_workflow
=
portal
.
portal_workflow
...
...
bt5/erp5_officejs_support_request_ui/SkinTemplateItem/portal_skins/erp5_officejs_support_request/ERP5Site_getTicketWorkflowWorklistInfoDict.py
View file @
a0dfb228
...
...
@@ -10,9 +10,9 @@ portal = context.getPortalObject()
query_dict
=
{}
workflow
=
portal
.
portal_workflow
.
ticket_workflow
workflow_state_var
=
workflow
.
variables
.
getStateVar
()
workflow_state_var
=
workflow
.
getStateVariable
()
for
worklist
in
workflow
.
worklists
.
objectValues
():
for
worklist
in
workflow
.
getWorklistValueList
():
identity_criterion_dict
=
worklist
.
getIdentityCriterionDict
()
if
portal_type
\
and
'portal_type'
in
worklist
.
getCriterionPropertyList
()
\
...
...
bt5/erp5_test_result/WorkflowTemplateItem/portal_workflow/test_result_workflow/script_TestResult_fail.py
View file @
a0dfb228
...
...
@@ -15,4 +15,4 @@ if test_result.getPortalType() == 'Test Result Node':
edit_kw
[
key
]
=
key_value
test_result
.
edit
(
**
edit_kw
)
else
:
cont
ext
.
TestResult_complete
(
sci
)
cont
ainer
.
script_
TestResult_complete
(
sci
)
bt5/erp5_travel_expense/WorkflowTemplateItem/portal_workflow/ticket_record_interaction_workflow/script_Ticket_updateRecord.py
View file @
a0dfb228
...
...
@@ -3,14 +3,14 @@ portal = context.getPortalObject()
portal_type
=
ticket
.
getPortalType
()
if
portal_type
in
(
"Leave Request"
,
"Leave Request Period"
):
cont
ext
.
Alarm_safeTrigger
(
cont
ainer
.
script_
Alarm_safeTrigger
(
portal
.
portal_alarms
.
create_representative_record_for_leave_request
)
elif
portal_type
in
(
"Expense Validation Request"
):
cont
ext
.
Alarm_safeTrigger
(
cont
ainer
.
script_
Alarm_safeTrigger
(
portal
.
portal_alarms
.
create_representative_record_for_expense_validation_request
)
elif
portal_type
in
(
"Travel Request"
):
cont
ext
.
Alarm_safeTrigger
(
cont
ainer
.
script_
Alarm_safeTrigger
(
portal
.
portal_alarms
.
create_representative_record_for_travel_request
)
product/ERP5Type/Base.py
View file @
a0dfb228
...
...
@@ -3534,7 +3534,11 @@ class Base(
# Use meta transition to jump from one state to another
# without existing transitions.
from
Products.ERP5Type
import
WITH_LEGACY_WORKFLOW
if
WITH_LEGACY_WORKFLOW
:
from
Products.ERP5.InteractionWorkflow
import
InteractionWorkflowDefinition
else
:
InteractionWorkflowDefinition
=
None
.
__class__
from
Products.ERP5Type.Core.InteractionWorkflow
import
InteractionWorkflow
portal
=
self
.
getPortalObject
()
workflow_tool
=
portal
.
portal_workflow
...
...
product/ERP5Type/Tool/WorkflowTool.py
View file @
a0dfb228
...
...
@@ -98,7 +98,10 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
This is public method to allow passing meta transition (Jump form
any state to another in same workflow)
"""
if
WITH_LEGACY_WORKFLOW
:
from
Products.ERP5.InteractionWorkflow
import
InteractionWorkflowDefinition
else
:
InteractionWorkflowDefinition
=
None
.
__class__
from
Products.ERP5Type.Core.InteractionWorkflow
import
InteractionWorkflow
workflow_list
=
self
.
getWorkflowValueListFor
(
ob
.
getPortalType
())
if
wf_id
is
None
:
...
...
@@ -124,7 +127,10 @@ class WorkflowTool(BaseTool, OriginalWorkflowTool):
"""Test if given state_id is available for ob
in at least one associated workflow
"""
if
WITH_LEGACY_WORKFLOW
:
from
Products.ERP5.InteractionWorkflow
import
InteractionWorkflowDefinition
else
:
InteractionWorkflowDefinition
=
None
.
__class__
from
Products.ERP5Type.Core.InteractionWorkflow
import
InteractionWorkflow
for
workflow
in
(
wf_id
and
(
self
[
wf_id
],)
or
self
.
getWorkflowValueListFor
(
ob
.
getPortalType
())):
if
not
isinstance
(
workflow
,
(
InteractionWorkflowDefinition
,
...
...
@@ -639,10 +645,10 @@ if WITH_LEGACY_WORKFLOW:
deprecated
(
'getWorkflowIds() is deprecated; use objectIds()'
)
\
(
lambda
self
:
self
.
objectIds
())
WorkflowTool
.
security
.
declarePrivate
(
'getWorkflowIds'
)
WorkflowTool
.
getWorkflowById
=
\
deprecated
(
'getWorkflowById() is deprecated'
)
\
(
lambda
self
,
wf_id
:
self
.
_getOb
(
wf_id
,
None
)
)
WorkflowTool
.
security
.
declarePrivate
(
'getWorkflowById'
)
# XXX We still use portal_workflow.getInfoFor, that calls WorkflowTool.getWorkflowById
WorkflowTool
.
getWorkflowById
=
lambda
self
,
wf_id
:
self
.
_getOb
(
wf_id
,
None
)
WorkflowTool
.
security
.
declarePrivate
(
'getWorkflowById'
)
InitializeClass
(
WorkflowTool
)
...
...
product/ERP5Type/ZopePatch.py
View file @
a0dfb228
...
...
@@ -37,8 +37,7 @@ if WITH_LEGACY_WORKFLOW:
from
Products.ERP5Type.patches
import
DCWorkflow
from
Products.ERP5Type.patches
import
Worklists
from
Products.ERP5Type.patches
import
BTreeFolder2
if
WITH_LEGACY_WORKFLOW
:
from
Products.ERP5Type.patches
import
WorkflowTool
from
Products.ERP5Type.patches
import
WorkflowTool
from
Products.ERP5Type.patches
import
DynamicType
from
Products.ERP5Type.patches
import
Expression
from
Products.ERP5Type.patches
import
sqltest
...
...
@@ -63,8 +62,7 @@ from Products.ERP5Type.patches import DateTimePatch
from
Products.ERP5Type.patches
import
PythonScript
from
Products.ERP5Type.patches
import
MailHost
from
Products.ERP5Type.patches
import
memcache_client
if
WITH_LEGACY_WORKFLOW
:
from
Products.ERP5Type.patches
import
StateChangeInfoPatch
from
Products.ERP5Type.patches
import
StateChangeInfoPatch
from
Products.ERP5Type.patches
import
transforms
from
Products.ERP5Type.patches
import
OFSPdata
from
Products.ERP5Type.patches
import
DemoStorage
...
...
product/ERP5Type/patches/StateChangeInfoPatch.py
View file @
a0dfb228
...
...
@@ -27,7 +27,6 @@
##############################################################################
from
Products.ERP5Type
import
WITH_LEGACY_WORKFLOW
assert
WITH_LEGACY_WORKFLOW
from
Products.DCWorkflow.Expression
import
StateChangeInfo
from
Products.PythonScripts.Utility
import
allow_class
...
...
product/ERP5Type/patches/WorkflowTool.py
View file @
a0dfb228
...
...
@@ -13,41 +13,7 @@
#
##############################################################################
from
Products.ERP5Type
import
WITH_LEGACY_WORKFLOW
assert
WITH_LEGACY_WORKFLOW
from
zLOG
import
LOG
,
WARNING
from
types
import
StringTypes
# Make sure Interaction Workflows are called even if method not wrapped
from
AccessControl
import
ClassSecurityInfo
,
Unauthorized
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.CMFCore.WorkflowTool
import
WorkflowTool
from
Products.CMFCore.WorkflowCore
import
ObjectDeleted
from
Products.CMFCore.WorkflowCore
import
WorkflowException
from
Products.DCWorkflow.DCWorkflow
import
DCWorkflowDefinition
from
Products.DCWorkflow.Transitions
import
TRIGGER_WORKFLOW_METHOD
from
Products.DCWorkflow.utils
import
Message
as
_
from
Products.DCWorkflow.Transitions
import
TRIGGER_USER_ACTION
from
Products.CMFCore.utils
import
getToolByName
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
AutoQuery
,
ComplexQuery
,
NegatedQuery
from
Products.CMFCore.utils
import
_getAuthenticatedUser
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Workflow
import
WorkflowHistoryList
as
NewWorkflowHistoryList
from
sets
import
ImmutableSet
from
Acquisition
import
aq_base
from
Products.ERP5Type.Globals
import
PersistentMapping
from
MySQLdb
import
ProgrammingError
,
OperationalError
from
DateTime
import
DateTime
security
=
ClassSecurityInfo
()
WorkflowTool
.
security
=
security
WORKLIST_METADATA_KEY
=
'metadata'
SECURITY_PARAMETER_ID
=
'local_roles'
class
WorkflowHistoryList
(
NewWorkflowHistoryList
):
...
...
@@ -105,21 +71,56 @@ class WorkflowHistoryList(NewWorkflowHistoryList):
# BBB: A production instance used a temporary patch to speed up.
WorkflowHistoryBucketList
=
WorkflowHistoryList
def
WorkflowTool_getChainDict
(
self
):
from
Products.ERP5Type
import
WITH_LEGACY_WORKFLOW
if
WITH_LEGACY_WORKFLOW
:
import
six
from
zLOG
import
LOG
,
WARNING
from
types
import
StringTypes
# Make sure Interaction Workflows are called even if method not wrapped
from
AccessControl
import
ClassSecurityInfo
,
Unauthorized
from
Products.ERP5Type.Globals
import
InitializeClass
from
Products.CMFCore.WorkflowTool
import
WorkflowTool
from
Products.CMFCore.WorkflowCore
import
ObjectDeleted
from
Products.CMFCore.WorkflowCore
import
WorkflowException
from
Products.DCWorkflow.DCWorkflow
import
DCWorkflowDefinition
from
Products.DCWorkflow.Transitions
import
TRIGGER_WORKFLOW_METHOD
from
Products.DCWorkflow.utils
import
Message
as
_
from
Products.DCWorkflow.Transitions
import
TRIGGER_USER_ACTION
from
Products.CMFCore.utils
import
getToolByName
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
AutoQuery
,
ComplexQuery
,
NegatedQuery
from
Products.CMFCore.utils
import
_getAuthenticatedUser
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type.Cache
import
CachingMethod
from
sets
import
ImmutableSet
from
Acquisition
import
aq_base
from
Products.ERP5Type.Globals
import
PersistentMapping
from
MySQLdb
import
ProgrammingError
,
OperationalError
from
DateTime
import
DateTime
security
=
ClassSecurityInfo
()
WorkflowTool
.
security
=
security
WORKLIST_METADATA_KEY
=
'metadata'
SECURITY_PARAMETER_ID
=
'local_roles'
def
WorkflowTool_getChainDict
(
self
):
"""Test if the given transition exist from the current state.
"""
chain_dict
=
{}
for
portal_type
,
wf_id_list
in
self
.
_chains_by_type
.
iteritems
(
):
for
portal_type
,
wf_id_list
in
six
.
iteritems
(
self
.
_chains_by_type
):
for
wf_id
in
wf_id_list
:
chain_dict
.
setdefault
(
wf_id
,
[]).
append
(
portal_type
)
return
chain_dict
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getChainDict'
)
WorkflowTool
.
getChainDict
=
WorkflowTool_getChainDict
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getChainDict'
)
WorkflowTool
.
getChainDict
=
WorkflowTool_getChainDict
# Backward compatibility, as WorkflowMethod has been removed in CMFCore 2.2
from
MethodObject
import
Method
class
WorkflowMethod
(
Method
):
# Backward compatibility, as WorkflowMethod has been removed in CMFCore 2.2
from
MethodObject
import
Method
class
WorkflowMethod
(
Method
):
""" Wrap a method to workflow-enable it.
"""
...
...
@@ -150,14 +151,14 @@ class WorkflowMethod( Method ):
res
=
wf
.
wrapWorkflowMethod
(
instance
,
self
.
_id
,
self
.
_m
,
(
instance
,)
+
args
,
kw
)
from
Products.CMFCore
import
WorkflowCore
# BBB: WorkflowMethod has been removed from CMFCore 2
WorkflowCore
.
WorkflowAction
=
WorkflowMethod
from
Products.CMFCore
import
WorkflowCore
# BBB: WorkflowMethod has been removed from CMFCore 2
WorkflowCore
.
WorkflowAction
=
WorkflowMethod
# XXX: Kept here instead of ERP5Type.Tool.WorkflowTool because not used in
# erp5.git: is it used in projects?
security
.
declarePublic
(
'canDoActionFor'
)
def
canDoActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
guard_kw
=
{}):
# XXX: Kept here instead of ERP5Type.Tool.WorkflowTool because not used in
# erp5.git: is it used in projects?
security
.
declarePublic
(
'canDoActionFor'
)
def
canDoActionFor
(
self
,
ob
,
action
,
wf_id
=
None
,
guard_kw
=
{}):
""" Check we can perform the given workflow action on 'ob'.
"""
if
wf_id
is
None
:
...
...
@@ -180,10 +181,10 @@ def canDoActionFor(self, ob, action, wf_id=None, guard_kw={}):
raise
WorkflowException
(
_
(
u"No workflow provides the '${action_id}' action."
,
mapping
=
{
'action_id'
:
action
}))
WorkflowTool
.
canDoActionFor
=
canDoActionFor
WorkflowTool
.
canDoActionFor
=
canDoActionFor
security
.
declarePrivate
(
'_listTypeInfo'
)
def
_listTypeInfo
(
self
):
security
.
declarePrivate
(
'_listTypeInfo'
)
def
_listTypeInfo
(
self
):
""" List the portal types which are available.
"""
# <patch>
...
...
@@ -193,17 +194,17 @@ def _listTypeInfo(self):
return
ttool
.
listTypeInfo
()
return
()
WorkflowTool
.
_listTypeInfo
=
_listTypeInfo
WorkflowTool
.
_listTypeInfo
=
_listTypeInfo
## From here on: migration/compatibility code DCWorkflow => ERP5 Workflow
## From here on: migration/compatibility code DCWorkflow => ERP5 Workflow
# The following 2 functions are necessary for workflow tool dynamic migration
def
WorkflowTool_isBootstrapRequired
(
self
):
# The following 2 functions are necessary for workflow tool dynamic migration
def
WorkflowTool_isBootstrapRequired
(
self
):
# migration is required if the tool is not the new one from ERP5 Workflow
# in case of old workflow tool, it acquires the portal type from ERP5 Site
return
self
.
getPortalType
()
!=
"Workflow Tool"
def
WorkflowTool_bootstrap
(
self
):
def
WorkflowTool_bootstrap
(
self
):
"""
Migrate portal_workflow from CMFCore to ERP5 Workflow. Also migrate
Workflow Chains not defined anymore on portal_workflow but on the Portal
...
...
@@ -244,20 +245,20 @@ def WorkflowTool_bootstrap(self):
if
getattr
(
new_tool
,
'_chains_by_type'
,
None
)
is
not
None
:
new_tool
.
reassignWorkflowWithoutConversion
()
WorkflowTool
.
_isBootstrapRequired
=
WorkflowTool_isBootstrapRequired
WorkflowTool
.
_bootstrap
=
WorkflowTool_bootstrap
WorkflowTool
.
getWorkflowValueListFor
=
WorkflowTool
.
getWorkflowsFor
WorkflowTool
.
_isBootstrapRequired
=
WorkflowTool_isBootstrapRequired
WorkflowTool
.
_bootstrap
=
WorkflowTool_bootstrap
WorkflowTool
.
getWorkflowValueListFor
=
WorkflowTool
.
getWorkflowsFor
def
_deleteChainsByType
(
self
,
pt
,
wf_id
):
def
_deleteChainsByType
(
self
,
pt
,
wf_id
):
self
.
_chains_by_type
[
pt
]
=
tuple
(
wf
for
wf
in
self
.
_chains_by_type
[
pt
]
if
wf
!=
wf_id
)
def
getChainsByType
(
self
):
def
getChainsByType
(
self
):
# XXX(WORKFLOW): compatibility code
# get old workflow tool's chains_by_type
if
self
.
_chains_by_type
is
None
:
return
{}
return
self
.
_chains_by_type
.
copy
()
WorkflowTool
.
getChainsByType
=
getChainsByType
def
reassignWorkflow
(
self
,
workflow_id
):
WorkflowTool
.
getChainsByType
=
getChainsByType
def
reassignWorkflow
(
self
,
workflow_id
):
# type-workflow reassignment
type_workflow_dict
=
self
.
getChainsByType
()
type_tool
=
self
.
getPortalObject
().
portal_types
...
...
@@ -274,8 +275,8 @@ def reassignWorkflow(self, workflow_id):
portal_type
.
setTypeWorkflowList
(
type_workflow_list
+
[
workflow_id
]
)
WorkflowTool
.
reassignWorkflow
=
reassignWorkflow
def
reassignWorkflowWithoutConversion
(
self
):
WorkflowTool
.
reassignWorkflow
=
reassignWorkflow
def
reassignWorkflowWithoutConversion
(
self
):
# This function should be called when a new template installed and add
# portal_types assignment with converted and non-converted workflows into
# portal_type's workflow list.
...
...
@@ -305,10 +306,10 @@ def reassignWorkflowWithoutConversion(self):
portal_type
.
setTypeWorkflowList
(
type_workflow_list
+
[
workflow_id
]
)
WorkflowTool
.
reassignWorkflowWithoutConversion
=
reassignWorkflowWithoutConversion
WorkflowTool
.
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
WorkflowTool
.
reassignWorkflowWithoutConversion
=
reassignWorkflowWithoutConversion
WorkflowTool
.
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getWorkflowTempObjectList'
)
def
getWorkflowTempObjectList
(
self
,
temp_object
=
1
,
**
kw
):
def
getWorkflowTempObjectList
(
self
,
temp_object
=
1
,
**
kw
):
""" Return a list of converted temporary workflows. Only necessary in
Workflow Tool to get temporarilly converted DCWorkflow.
"""
...
...
@@ -320,6 +321,6 @@ def getWorkflowTempObjectList(self, temp_object=1, **kw):
temp_workflow
=
dc_workflow
.
convertToERP5Workflow
(
temp_object
=
temp_object
)
temp_workflow_list
.
append
(
temp_workflow
)
return
temp_workflow_list
WorkflowTool
.
getWorkflowTempObjectList
=
getWorkflowTempObjectList
WorkflowTool
.
getWorkflowTempObjectList
=
getWorkflowTempObjectList
InitializeClass
(
WorkflowTool
)
InitializeClass
(
WorkflowTool
)
product/ERP5Type/tests/SecurityTestCase.py
View file @
a0dfb228
...
...
@@ -38,7 +38,6 @@ from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type
import
Permissions
from
Products.ERP5.InteractionWorkflow
import
InteractionWorkflowDefinition
from
Products.ERP5Type.Base
import
Base
...
...
product/ERP5Type/tests/testERP5NamingConvention.py
View file @
a0dfb228
...
...
@@ -28,6 +28,7 @@
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type
import
WITH_LEGACY_WORKFLOW
from
Testing
import
ZopeTestCase
class
TestNamingConvention
(
ERP5TypeTestCase
):
...
...
@@ -65,7 +66,7 @@ class TestNamingConvention(ERP5TypeTestCase):
'erp5_promise'
,
'erp5_software_pdm'
,
'erp5_sso_openam'
,
'erp5_jquery_plugin_hotkey'
,
'erp5_jquery_plugin_jgraduate'
,
'erp5_jquery_plugin_svgicon'
,
'erp5_jquery_plugin_jquerybbq'
,
'erp5_jquery_plugin_spinbtn'
,
'erp5_jquery_plugin_svg_editor'
,
'erp5_svg_editor'
,
'erp5_syncml'
,
'erp5_system_event'
,
'erp5_tiosafe_core'
,
'erp5_workflow_test'
,
'erp5_system_event'
,
'erp5_tiosafe_core'
,
'erp5_public_accounting_budget'
,
'erp5_publication'
,
'erp5_social_contracts'
,
'test_core'
,
'test_accounting'
,
'test_web'
,
'test_html_style'
,
'test_xhtml_style'
,
'cloudooo_data'
,
'cloudooo_web'
,
'erp5_configurator'
,
...
...
@@ -79,7 +80,7 @@ class TestNamingConvention(ERP5TypeTestCase):
# 'erp5_accounting_l10n_pl',
# 'erp5_accounting_l10n_sn',
# 'erp5_accounting_l10n_in',
)
)
+
((
'erp5_workflow_test'
,)
if
WITH_LEGACY_WORKFLOW
else
())
def
getTitle
(
self
):
return
"Naming Convention"
...
...
product/ERP5Type/tests/testUpgradeInstanceWithOldDataFs.py
View file @
a0dfb228
...
...
@@ -26,7 +26,9 @@
#
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type
import
WITH_LEGACY_WORKFLOW
import
StringIO
import
unittest
import
urllib
import
httplib
...
...
@@ -149,3 +151,9 @@ class TestUpgradeInstanceWithOldDataFs(ERP5TypeTestCase):
self
.
assertEquals
(
error_list
,
[],
msg
=
"The following Portal Type classes could not be loaded (see zLOG.log): %r"
%
error_list
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
if
WITH_LEGACY_WORKFLOW
:
suite
.
addTest
(
unittest
.
makeSuite
(
TestUpgradeInstanceWithOldDataFs
))
return
suite
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