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
0
Merge Requests
0
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
erp5
Commits
4486252e
Commit
4486252e
authored
Dec 18, 2018
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_trade: add cancel state/transition
parent
2c407c9f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
309 additions
and
13 deletions
+309
-13
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_report_workflow/states/cancelled.xml
...l_workflow/inventory_report_workflow/states/cancelled.xml
+108
-0
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_report_workflow/states/recorded.xml
...al_workflow/inventory_report_workflow/states/recorded.xml
+4
-1
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_report_workflow/transitions/cancel.xml
...workflow/inventory_report_workflow/transitions/cancel.xml
+80
-0
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_report_workflow/transitions/cancel_action.xml
...w/inventory_report_workflow/transitions/cancel_action.xml
+80
-0
product/ERP5/tests/testInventoryReportModule.py
product/ERP5/tests/testInventoryReportModule.py
+37
-12
No files found.
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_report_workflow/states/cancelled.xml
0 → 100644
View file @
4486252e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"StateDefinition"
module=
"Products.DCWorkflow.States"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
cancelled
</string>
</value>
</item>
<item>
<key>
<string>
permission_roles
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Cancelled
</string>
</value>
</item>
<item>
<key>
<string>
transitions
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
type_list
</string>
</key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
Access contents information
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
Add portal content
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
Delete objects
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
Modify portal content
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
View
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_report_workflow/states/recorded.xml
View file @
4486252e
...
@@ -27,7 +27,10 @@
...
@@ -27,7 +27,10 @@
<item>
<item>
<key>
<string>
transitions
</string>
</key>
<key>
<string>
transitions
</string>
</key>
<value>
<value>
<tuple/>
<tuple>
<string>
cancel
</string>
<string>
cancel_action
</string>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
...
...
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_report_workflow/transitions/cancel.xml
0 → 100644
View file @
4486252e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"TransitionDefinition"
module=
"Products.DCWorkflow.Transitions"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
actbox_category
</string>
</key>
<value>
<string>
workflow
</string>
</value>
</item>
<item>
<key>
<string>
actbox_icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
cancel
</string>
</value>
</item>
<item>
<key>
<string>
new_state_id
</string>
</key>
<value>
<string>
cancelled
</string>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Cancel Inventory Report
</string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
2
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Guard"
module=
"Products.DCWorkflow.Guard"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
roles
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_report_workflow/transitions/cancel_action.xml
0 → 100644
View file @
4486252e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"TransitionDefinition"
module=
"Products.DCWorkflow.Transitions"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
actbox_category
</string>
</key>
<value>
<string>
workflow
</string>
</value>
</item>
<item>
<key>
<string>
actbox_icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
actbox_name
</string>
</key>
<value>
<string>
Cancel Inventory Report
</string>
</value>
</item>
<item>
<key>
<string>
actbox_url
</string>
</key>
<value>
<string>
%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=cancel_action
</string>
</value>
</item>
<item>
<key>
<string>
after_script_name
</string>
</key>
<value>
<string>
cancel
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
guard
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
cancel_action
</string>
</value>
</item>
<item>
<key>
<string>
new_state_id
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
script_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Calcal Inventory Report Acton
</string>
</value>
</item>
<item>
<key>
<string>
trigger_type
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Guard"
module=
"Products.DCWorkflow.Guard"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
roles
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/tests/testInventoryReportModule.py
View file @
4486252e
...
@@ -611,48 +611,73 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
...
@@ -611,48 +611,73 @@ class TestInventoryReportModule(TestOrderMixin, SecurityTestCase):
"""
"""
"""
"""
if
not
run
:
return
if
not
run
:
return
self
.
createUser
(
'test_creator'
,
user_id_list
=
[
'test_user'
,
'manager'
]
[
'Auditor'
,
'Author'
])
user_id_list
=
[
'test_creator'
,
'test_user'
,
'manager'
]
for
user
in
user_id_list
:
for
user
in
user_id_list
:
self
.
failUnlessUserCanAddDocument
(
user
,
self
.
getInventoryReportModule
())
self
.
failUnlessUserCanAddDocument
(
user
,
self
.
getInventoryReportModule
())
self
.
login
(
user_id_list
[
0
])
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
inventory_report
=
self
.
getInventoryReportModule
().
newContent
(
portal_type
=
'Inventory Report'
)
self
.
login
()
for
user
in
user_id_list
:
self
.
failUnlessUserCanAddDocument
(
user
,
inventory_report
)
inventory_report_line
=
inventory_report
.
newContent
(
portal_type
=
'Inventory Report Line'
)
inventory_report_line
=
inventory_report
.
newContent
(
portal_type
=
'Inventory Report Line'
)
self
.
assertEqual
(
inventory_report
.
getSimulationState
(),
'draft'
)
self
.
assertEqual
(
inventory_report
.
getSimulationState
(),
'draft'
)
self
.
tic
()
self
.
tic
()
for
user
in
user_id_list
:
for
user
in
user_id_list
:
self
.
login
(
user
)
self
.
login
(
user
)
self
.
assertEqual
(
self
.
portal
.
portal_workflow
.
isTransitionPossible
(
inventory_report
,
'calculate'
),
True
)
self
.
assertEqual
(
self
.
portal
.
portal_workflow
.
isTransitionPossible
(
inventory_report
,
'calculate'
),
True
)
self
.
failUnlessUserCanModifyDocument
(
user
,
inventory_report
)
self
.
failUnlessUserCanModifyDocument
(
user
,
inventory_report
)
self
.
failUnlessUserCanModifyDocument
(
user
,
inventory_report_line
)
self
.
failUnlessUserCanModifyDocument
(
user
,
inventory_report_line
)
inventory_report
.
calculate
()
inventory_report
.
calculate
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
inventory_report
.
getSimulationState
(),
'calculating'
)
self
.
assertEqual
(
inventory_report
.
getSimulationState
(),
'calculating'
)
for
user
in
user_id_list
:
for
user
in
user_id_list
:
self
.
login
(
user
)
self
.
login
(
user
)
self
.
assertEqual
(
self
.
portal
.
portal_workflow
.
isTransitionPossible
(
inventory_report
,
'record'
),
True
)
self
.
assertEqual
(
self
.
portal
.
portal_workflow
.
isTransitionPossible
(
inventory_report
,
'record'
),
True
)
self
.
failUnlessUserCanModifyDocument
(
user
,
inventory_report
)
self
.
failUnlessUserCanModifyDocument
(
user
,
inventory_report
)
self
.
failUnlessUserCanModifyDocument
(
user
,
inventory_report_line
)
self
.
failUnlessUserCanModifyDocument
(
user
,
inventory_report_line
)
inventory_report
.
record
()
inventory_report
.
record
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
inventory_report
.
getSimulationState
(),
'recorded'
)
self
.
assertEqual
(
inventory_report
.
getSimulationState
(),
'recorded'
)
for
user
in
user_id_list
:
for
user
in
user_id_list
:
self
.
login
(
user
)
self
.
login
(
user
)
self
.
assertEqual
(
self
.
portal
.
portal_workflow
.
isTransitionPossible
(
inventory_report
,
'calculate'
),
False
)
self
.
assertEqual
(
self
.
portal
.
portal_workflow
.
isTransitionPossible
(
inventory_report
,
'calculate'
),
False
)
self
.
failIfUserCanModifyDocument
(
'test_user'
,
inventory_report
)
self
.
login
()
self
.
failUnlessUserCanViewDocument
(
'test_user'
,
inventory_report
)
self
.
failIfUserCanPassWorkflowTransition
(
user_id_list
[
0
],
'cancel_action'
,
inventory_report
)
self
.
failIfUserCanModifyDocument
(
'test_user'
,
inventory_report_line
)
for
user
in
user_id_list
[
1
:]:
self
.
failUnlessUserCanViewDocument
(
'test_user'
,
inventory_report_line
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
,
'cancel_action'
,
inventory_report
)
for
user
in
user_id_list
[:
-
1
]:
self
.
failIfUserCanModifyDocument
(
user
,
inventory_report
)
self
.
failUnlessUserCanViewDocument
(
user
,
inventory_report
)
self
.
failIfUserCanModifyDocument
(
user
,
inventory_report_line
)
self
.
failUnlessUserCanViewDocument
(
user
,
inventory_report_line
)
self
.
failUnlessUserCanModifyDocument
(
'manager'
,
inventory_report
)
self
.
failUnlessUserCanModifyDocument
(
'manager'
,
inventory_report
)
self
.
failUnlessUserCanModifyDocument
(
'manager'
,
inventory_report_line
)
self
.
failUnlessUserCanModifyDocument
(
'manager'
,
inventory_report_line
)
inventory_report
.
cancel
()
self
.
tic
()
self
.
assertEqual
(
inventory_report
.
getSimulationState
(),
'cancelled'
)
for
user
in
user_id_list
[:
-
1
]:
self
.
failIfUserCanModifyDocument
(
user
,
inventory_report
)
self
.
failUnlessUserCanViewDocument
(
user
,
inventory_report
)
self
.
failIfUserCanModifyDocument
(
user
,
inventory_report_line
)
self
.
failUnlessUserCanViewDocument
(
user
,
inventory_report_line
)
self
.
failUnlessUserCanModifyDocument
(
'manager'
,
inventory_report
)
self
.
failUnlessUserCanModifyDocument
(
'manager'
,
inventory_report_line
)
def
test_02_checkCalculateProduct
(
self
,
run
=
run_all_test
):
def
test_02_checkCalculateProduct
(
self
,
run
=
run_all_test
):
"""
"""
...
...
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