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
amrani
erp5
Commits
8352cf33
Commit
8352cf33
authored
May 30, 2011
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for product which is variated and have multiple quantity units.
parent
d6d75962
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
0 deletions
+94
-0
product/ERP5/tests/testInventory.py
product/ERP5/tests/testInventory.py
+48
-0
product/ERP5/tests/testOrder.py
product/ERP5/tests/testOrder.py
+46
-0
No files found.
product/ERP5/tests/testInventory.py
View file @
8352cf33
...
...
@@ -328,6 +328,15 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
)
sequence
.
edit
(
delivery_line_list
=
delivery_line_list
)
def
stepCreateVariatedNonDefaultQuantityUnitPackingListLine
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Create a line not variated
"""
self
.
stepCreateVariatedPackingListLine
(
sequence
,
sequence_list
,
**
kw
)
delivery_line
=
sequence
.
get
(
'delivery_line_list'
)[
-
1
]
delivery_line
.
setQuantityUnitValue
(
self
.
portal
.
portal_categories
.
quantity_unit
.
unit
.
drum
)
def
stepDeliverPackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# Switch to "started" state
...
...
@@ -1778,6 +1787,20 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
self
.
checkVariatedInventory
(
variation_category_list
=
variation_category_list
,
quantity
=
quantity
,
sequence
=
sequence
)
def
stepTestInitialVariatedNonDefaultQuantityUnitInventory
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Test Inventory Module behavior
"""
resource
=
sequence
.
get
(
'resource'
)
variation_category_list
=
sequence
.
get
(
'variation_1'
)
quantity
=
100
self
.
checkVariatedInventory
(
variation_category_list
=
variation_category_list
,
quantity
=
quantity
,
sequence
=
sequence
)
variation_category_list
=
sequence
.
get
(
'variation_2'
)
quantity
=
300
self
.
checkVariatedInventory
(
variation_category_list
=
variation_category_list
,
quantity
=
quantity
,
sequence
=
sequence
)
def
stepTestVariatedInventoryAfterInventory
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Test Inventory Module behavior
...
...
@@ -1928,6 +1951,31 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
sequence_list
.
play
(
self
)
def
test_04_InventoryModuleWithVariationAndMultiQuantityUnit
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Test InventoryModule behavior with product which has
variation and multiple quantity units.
"""
if
not
run
:
return
sequence_list
=
SequenceList
()
sequence_string
=
'stepCreateOrganisationsForModule
\
stepCreateVariatedMultipleQuantityUnitResource
\
stepTic
\
stepCreatePackingListForModule
\
stepTic
\
stepCreateVariatedNonDefaultQuantityUnitPackingListLine
\
stepTic
\
stepDeliverPackingList
\
stepTic
\
stepTestInitialVariatedNonDefaultQuantityUnitInventory
\
stepCreateSingleVariatedInventory
\
stepTic
\
stepTestVariatedInventoryAfterInventory
\
'
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestInventory
))
...
...
product/ERP5/tests/testOrder.py
View file @
8352cf33
...
...
@@ -218,6 +218,52 @@ class TestOrderMixin(SubcontentReindexingWrapper):
resource_list
.
append
(
resource
)
sequence
.
edit
(
resource_list
=
resource_list
)
def
stepCreateVariatedMultipleQuantityUnitResource
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Create a resource with variation and multiple quantity units
"""
# Extend quantity_unit category if needed
quantity_unit
=
self
.
portal
.
portal_categories
.
quantity_unit
if
not
'unit'
in
quantity_unit
.
objectIds
():
quantity_unit
.
newContent
(
id
=
'unit'
)
if
not
'drum'
in
quantity_unit
.
unit
.
objectIds
():
quantity_unit
.
unit
.
newContent
(
id
=
'drum'
,
quantity
=
1
)
if
not
'mass'
in
quantity_unit
.
objectIds
():
quantity_unit
.
newContent
(
id
=
'mass'
)
if
not
'kilogram'
in
quantity_unit
.
mass
.
objectIds
():
quantity_unit
.
mass
.
newContent
(
id
=
'kilogram'
,
quantity
=
1
)
# Extend metric_type category if needed
metric_type
=
self
.
portal
.
portal_categories
.
metric_type
if
not
'unit'
in
metric_type
.
objectIds
():
metric_type
.
newContent
(
id
=
'unit'
)
if
not
'mass'
in
metric_type
.
objectIds
():
metric_type
.
newContent
(
id
=
'mass'
)
# Create resource
self
.
stepCreateVariatedResource
(
sequence
,
sequence_list
,
**
kw
)
resource
=
sequence
.
get
(
'resource'
)
# Extend resource portal type
resource_portal_type
=
getattr
(
self
.
portal
.
portal_types
,
resource
.
portal_type
)
type_allowed_content_type_list
=
resource_portal_type
.
getTypeAllowedContentTypeList
()
if
not
'Measure'
in
type_allowed_content_type_list
:
type_allowed_content_type_list
.
append
(
'Measure'
)
resource_portal_type
.
setTypeAllowedContentTypeList
(
type_allowed_content_type_list
)
# Set quantity units to product
resource
.
setQuantityUnitValueList
([
quantity_unit
.
mass
.
kilogram
,
quantity_unit
.
unit
.
drum
])
# Set measures to products
resource
.
newContent
(
portal_type
=
'Measure'
,
metric_type_value
=
metric_type
.
mass
,
default_metric_type
=
True
,
quantity_unit_value
=
quantity_unit
.
mass
.
kilogram
,
quantity
=
1
)
resource
.
newContent
(
portal_type
=
'Measure'
,
metric_type_value
=
metric_type
.
unit
,
quantity_unit_value
=
quantity_unit
.
unit
.
drum
,
quantity
=
0.01
)
def
stepCreateOrganisation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
title
=
None
,
**
kw
):
"""
...
...
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