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
140
Merge Requests
140
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
dc06aafe
Commit
dc06aafe
authored
Jul 26, 2012
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test_MultipleSectionAndFullInventory again. I removed it by mistake...
parent
2392fbcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
120 additions
and
0 deletions
+120
-0
product/ERP5/tests/testInventoryAPI.py
product/ERP5/tests/testInventoryAPI.py
+120
-0
No files found.
product/ERP5/tests/testInventoryAPI.py
View file @
dc06aafe
...
...
@@ -2765,6 +2765,126 @@ class TestInventoryDocument(InventoryAPITestCase):
optimisation__
=
False
,
mirror_uid
=
self
.
mirror_node
.
getUid
())])
@
expectedFailure
def
test_MultipleSectionAndFullInventory
(
self
):
"""Make sure that getInventoryList works in the situation which
two sections use the same node and one section has full inventory for
the node.
"""
# In this test we do not need doucments made by afterSetUp.
self
.
portal
.
inventory_module
.
manage_delObjects
(
list
(
self
.
portal
.
inventory_module
.
objectIds
()))
self
.
folder
.
manage_delObjects
(
list
(
self
.
folder
.
objectIds
()))
self
.
commit
()
self
.
tic
()
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
'Inventory_getDefaultInventoryCalculationList'
,
''
,
'''return ({
'inventory_params':{
'section_uid':context.getDestinationSectionUid(),
'node_uid':context.getDestinationUid(),
'group_by_variation':1,
'group_by_resource':1},
'list_method':'getMovementList',
'first_level':({'key':'resource_relative_url',
'getter':'getResource',
'setter':('appendToCategoryList', 'resource')},
{'key':'variation_text',
'getter':'getVariationText',
'setter':'splitAndExtendToCategoryList'},
),
},)
'''
)
self
.
commit
()
getCurrentInventoryList
=
self
.
getSimulationTool
().
getCurrentInventoryList
# Add movements for section
self
.
_makeMovement
(
source_section_value
=
None
,
source_value
=
None
,
destination_section_value
=
self
.
section
,
destination_value
=
self
.
node
,
start_date
=
DateTime
(
'2012/07/18 00:00:00 GMT+9'
),
simulation_state
=
'delivered'
,
resource_value
=
self
.
resource
,
quantity
=
1
)
self
.
_makeMovement
(
source_section_value
=
None
,
source_value
=
None
,
destination_section_value
=
self
.
section
,
destination_value
=
self
.
node
,
start_date
=
DateTime
(
'2012/07/21 00:00:00 GMT+9'
),
simulation_state
=
'delivered'
,
resource_value
=
self
.
resource
,
quantity
=
2
)
# Add movemnets for other section
self
.
_makeMovement
(
source_section_value
=
None
,
source_value
=
None
,
destination_section_value
=
self
.
other_section
,
destination_value
=
self
.
node
,
start_date
=
DateTime
(
'2012/07/19 00:00:00 GMT+9'
),
simulation_state
=
'delivered'
,
resource_value
=
self
.
resource
,
quantity
=
3
)
self
.
_makeMovement
(
source_section_value
=
None
,
source_value
=
None
,
destination_section_value
=
self
.
other_section
,
destination_value
=
self
.
node
,
start_date
=
DateTime
(
'2012/07/20 00:00:00 GMT+9'
),
simulation_state
=
'delivered'
,
resource_value
=
self
.
resource
,
quantity
=
4
)
self
.
commit
()
self
.
tic
()
# Check inventory
result
=
{}
for
brain
in
getCurrentInventoryList
(
node_uid
=
self
.
node
.
getUid
(),
group_by_resource
=
1
,
group_by_node
=
1
,
group_by_section
=
1
):
key
=
(
brain
.
section_uid
,
brain
.
node_uid
,
brain
.
resource_uid
)
if
not
key
in
result
:
result
[
key
]
=
0
result
[
key
]
=
result
[
key
]
+
brain
.
inventory
self
.
assertEqual
(
result
,
{(
self
.
section
.
getUid
(),
self
.
node
.
getUid
(),
self
.
resource
.
getUid
()):
3
,
(
self
.
other_section
.
getUid
(),
self
.
node
.
getUid
(),
self
.
resource
.
getUid
()):
7
})
# Add full inventory for section, not for other section
full_inventory1
=
self
.
portal
.
inventory_module
.
newContent
(
portal_type
=
'Inventory'
)
full_inventory1
.
edit
(
destination_section_value
=
self
.
section
,
destination_value
=
self
.
node
,
full_inventory
=
1
,
start_date
=
DateTime
(
'2012/07/20 00:00:00 GMT+9'
))
line
=
full_inventory1
.
newContent
(
portal_type
=
'Inventory Line'
)
line
.
setResourceValue
(
self
.
resource
)
line
.
setQuantity
(
100
)
full_inventory1
.
deliver
()
self
.
commit
()
self
.
tic
()
# Check inventory again. This time, full inventory should change
# section's inventory. It should not change other section's inventory.
result
=
{}
for
brain
in
getCurrentInventoryList
(
node_uid
=
self
.
node
.
getUid
(),
group_by_resource
=
1
,
group_by_node
=
1
,
group_by_section
=
1
):
key
=
(
brain
.
section_uid
,
brain
.
node_uid
,
brain
.
resource_uid
)
if
not
key
in
result
:
result
[
key
]
=
0
result
[
key
]
=
result
[
key
]
+
brain
.
inventory
self
.
assertEqual
(
result
,
{(
self
.
section
.
getUid
(),
self
.
node
.
getUid
(),
self
.
resource
.
getUid
()):
102
,
(
self
.
other_section
.
getUid
(),
self
.
node
.
getUid
(),
self
.
resource
.
getUid
()):
7
})
@
expectedFailure
def
test_ResourceCategory
(
self
):
"""Make sure that resource category works when full inventory exists."""
...
...
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