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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
a4c23866
Commit
a4c23866
authored
Oct 27, 2017
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Nov 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testMRP: update testSimpleOrder to integrate Manufacturing Order
parent
71a44eac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
41 deletions
+57
-41
product/ERP5/tests/testMRP.py
product/ERP5/tests/testMRP.py
+57
-41
No files found.
product/ERP5/tests/testMRP.py
View file @
a4c23866
...
@@ -35,6 +35,8 @@ class TestMRPMixin(TestBPMMixin):
...
@@ -35,6 +35,8 @@ class TestMRPMixin(TestBPMMixin):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
super
(
TestMRPMixin
,
self
).
afterSetUp
()
super
(
TestMRPMixin
,
self
).
afterSetUp
()
self
.
_createRule
(
"Transformation Simulation Rule"
)
self
.
_createRule
(
"Transformation Simulation Rule"
)
production_simulation_rule
=
self
.
_createRule
(
"Production Simulation Rule"
)
production_simulation_rule
.
setTradePhase
(
"manufacturing/order"
)
rule
=
self
.
_createRule
(
"Transformation Sourcing Simulation Rule"
)
rule
=
self
.
_createRule
(
"Transformation Sourcing Simulation Rule"
)
rule
.
_setSameTotalQuantity
(
False
)
rule
.
_setSameTotalQuantity
(
False
)
...
@@ -116,7 +118,7 @@ class TestMRPMixin(TestBPMMixin):
...
@@ -116,7 +118,7 @@ class TestMRPMixin(TestBPMMixin):
self
.
createCategoriesInCategory
(
category_tool
.
trade_phase
.
mrp
,
self
.
createCategoriesInCategory
(
category_tool
.
trade_phase
.
mrp
,
(
's'
+
str
(
i
)
for
i
in
xrange
(
1
)))
(
's'
+
str
(
i
)
for
i
in
xrange
(
1
)))
self
.
createCategoriesInCategory
(
category_tool
.
trade_state
,
self
.
createCategoriesInCategory
(
category_tool
.
trade_state
,
(
's'
+
str
(
i
)
for
i
in
xrange
(
5
)))
(
's'
+
str
(
i
)
for
i
in
xrange
(
6
)))
def
createDefaultOrder
(
self
,
business_process
,
transformation
=
None
):
def
createDefaultOrder
(
self
,
business_process
,
transformation
=
None
):
if
transformation
is
None
:
if
transformation
is
None
:
...
@@ -161,7 +163,7 @@ class TestMRPMixin(TestBPMMixin):
...
@@ -161,7 +163,7 @@ class TestMRPMixin(TestBPMMixin):
trade_phase
=
'mrp/p1'
)
trade_phase
=
'mrp/p1'
)
return
transformation
return
transformation
def
createBusinessProcess1
(
self
,
node_p0
=
None
):
def
createBusinessProcess1
(
self
,
node_p0
):
"""
"""
Terms
Terms
=====
=====
...
@@ -179,6 +181,7 @@ class TestMRPMixin(TestBPMMixin):
...
@@ -179,6 +181,7 @@ class TestMRPMixin(TestBPMMixin):
================
================
The Business process will proceed this way:
The Business process will proceed this way:
1/ Generate Production Order and confirm it
1/ Generate Production Order and confirm it
2/ Generate Manufacturing Order and confirm it
2/ Generate Manufacturing Execution p0 which generate a
2/ Generate Manufacturing Execution p0 which generate a
the product with a variation to indicate it is a partial product.
the product with a variation to indicate it is a partial product.
The variation is trade_phase/mrp/p0. It takes place in workshop2
The variation is trade_phase/mrp/p0. It takes place in workshop2
...
@@ -193,9 +196,9 @@ class TestMRPMixin(TestBPMMixin):
...
@@ -193,9 +196,9 @@ class TestMRPMixin(TestBPMMixin):
Business Process Schema
Business Process Schema
=======================
=======================
order p0 s0 p1 deliver
order
order
p0 s0 p1 deliver
------- S0 ----
S1 ---- S2 ---- S3 ------- S4
------- S0 ----
- S1 ---- S2 ---- S3 ---- S4 -------- S5
PO
ME1 PPL1
ME2 PPL2
PO
MO ME1 PPL1
ME2 PPL2
Simulation Tree
Simulation Tree
===============
===============
...
@@ -203,6 +206,8 @@ class TestMRPMixin(TestBPMMixin):
...
@@ -203,6 +206,8 @@ class TestMRPMixin(TestBPMMixin):
* Production Order Line
* Production Order Line
* default_delivering_rule
* default_delivering_rule
* PPL2
* PPL2
* default_production_rule
* MO
* default_transformation_rule
* default_transformation_rule
* input ME1
* input ME1
* input ME1
* input ME1
...
@@ -217,16 +222,18 @@ class TestMRPMixin(TestBPMMixin):
...
@@ -217,16 +222,18 @@ class TestMRPMixin(TestBPMMixin):
* output ME2
* output ME2
"""
"""
business_process
=
self
.
_createDocument
(
"Business Process"
)
business_process
=
self
.
_createDocument
(
"Business Process"
)
builder
=
'portal_deliveries/production_packing_list_builder'
production_packing_list_builder
=
'portal_deliveries/production_packing_list_builder'
manufacturing_execution_builder
=
'portal_deliveries/manufacturing_execution_builder'
manufacturing_order_builder
=
'portal_deliveries/manufacturing_order_builder'
completed
=
'delivered'
,
'started'
,
'stopped'
completed
=
'delivered'
,
'started'
,
'stopped'
phase_list
=
[
(
'default/order'
,
None
,
(
'confirmed'
,)),
phase_list
=
[
(
'default/delivery'
,
builder
,
completed
)]
(
'default/order'
,
None
,
(
'confirmed'
,)),
phase_list
[
1
:
1
]
=
[(
'mrp/p'
+
str
(
i
),
(
'manufacturing/order'
,
manufacturing_order_builder
,
(
'confirmed'
,)
),
'portal_deliveries/manufacturing_execution_builder'
,
(
'mrp/p0'
,
manufacturing_execution_builder
,
completed
)
,
completed
)
(
'mrp/s0'
,
production_packing_list_builder
,
completed
),
for
i
in
xrange
(
2
)]
(
'mrp/p1'
,
manufacturing_execution_builder
,
completed
),
if
node_p0
is
not
None
:
(
'default/delivery'
,
production_packing_list_builder
,
completed
)
phase_list
.
insert
(
2
,
(
'mrp/s0'
,
builder
,
completed
))
]
predecessor
=
None
predecessor
=
None
for
i
,
(
phase
,
builder
,
completed
)
in
enumerate
(
phase_list
):
for
i
,
(
phase
,
builder
,
completed
)
in
enumerate
(
phase_list
):
successor
=
'trade_state/s'
+
str
(
i
)
successor
=
'trade_state/s'
+
str
(
i
)
...
@@ -238,13 +245,12 @@ class TestMRPMixin(TestBPMMixin):
...
@@ -238,13 +245,12 @@ class TestMRPMixin(TestBPMMixin):
delivery_builder
=
builder
)
delivery_builder
=
builder
)
predecessor
=
successor
predecessor
=
successor
phase_list
=
[
x
[
0
]
for
x
in
phase_list
]
phase_list
=
[
x
[
0
]
for
x
in
phase_list
]
if
node_p0
is
not
None
:
self
.
createTradeModelPath
(
business_process
,
self
.
createTradeModelPath
(
business_process
,
destination_value
=
node_p0
,
destination_value
=
node_p0
,
trade_phase
=
phase_list
.
pop
(
1
))
trade_phase
=
phase_list
.
pop
(
2
))
self
.
createTradeModelPath
(
business_process
,
self
.
createTradeModelPath
(
business_process
,
test_tales_expression
=
"here/getSource"
,
test_tales_expression
=
"here/getSource"
,
trade_phase
=
phase_list
.
pop
(
1
))
trade_phase
=
phase_list
.
pop
(
2
))
self
.
createTradeModelPath
(
business_process
,
trade_phase_list
=
phase_list
)
self
.
createTradeModelPath
(
business_process
,
trade_phase_list
=
phase_list
)
return
business_process
return
business_process
...
@@ -288,6 +294,10 @@ class TestMRPImplementation(TestMRPMixin):
...
@@ -288,6 +294,10 @@ class TestMRPImplementation(TestMRPMixin):
ar
,
=
sm
.
objectValues
()
ar
,
=
sm
.
objectValues
()
# The final PPL
# The final PPL
sm
,
=
ar
.
objectValues
()
# deliver
sm
,
=
ar
.
objectValues
()
# deliver
# default_production_rule
ar
,
=
sm
.
objectValues
()
# Manufacturing Order Movements
sm
,
=
ar
.
objectValues
()
# Order
# default_transformation_rule
# default_transformation_rule
ar
,
=
sm
.
objectValues
()
ar
,
=
sm
.
objectValues
()
...
@@ -322,16 +332,22 @@ class TestMRPImplementation(TestMRPMixin):
...
@@ -322,16 +332,22 @@ class TestMRPImplementation(TestMRPMixin):
)))
)))
order
.
confirm
()
order
.
confirm
()
# Build Manufacturing Order
order
.
localBuild
()
order
.
localBuild
()
self
.
tic
()
self
.
tic
()
self
.
checkStock
(
resource
)
def
getRelatedDeliveryList
(
portal_type
):
def
getRelatedDeliveryList
(
portal_type
):
return
order
.
getCausalityRelatedValueList
(
portal_type
=
portal_type
)
return
order
.
getCausalityRelatedValueList
(
portal_type
=
portal_type
)
pr1
,
=
getRelatedDeliveryList
(
"Manufacturing Execution"
)
mo
,
=
getRelatedDeliveryList
(
"Manufacturing Order Line"
)
pr1
.
start
()
# Build First Manufacturing Execution
pr1
.
deliver
()
order
.
localBuild
()
self
.
tic
()
self
.
checkStock
(
resource
)
me1
,
=
getRelatedDeliveryList
(
"Manufacturing Execution"
)
me1
.
start
()
me1
.
deliver
()
order
.
localBuild
()
order
.
localBuild
()
self
.
tic
()
self
.
tic
()
variation
=
'industrial_phase/trade_phase/mrp/p0'
variation
=
'industrial_phase/trade_phase/mrp/p0'
...
@@ -344,10 +360,10 @@ class TestMRPImplementation(TestMRPMixin):
...
@@ -344,10 +360,10 @@ class TestMRPImplementation(TestMRPMixin):
self
.
tic
()
self
.
tic
()
self
.
checkStock
(
resource
,
(
self
.
workshop
,
variation
,
10
))
self
.
checkStock
(
resource
,
(
self
.
workshop
,
variation
,
10
))
pr
2
,
=
(
x
for
x
in
getRelatedDeliveryList
(
"Manufacturing Execution"
)
me
2
,
=
(
x
for
x
in
getRelatedDeliveryList
(
"Manufacturing Execution"
)
if
x
.
aq_base
is
not
pr
1
.
aq_base
)
if
x
.
aq_base
is
not
me
1
.
aq_base
)
pr
2
.
start
()
me
2
.
start
()
pr
2
.
deliver
()
me
2
.
deliver
()
order
.
localBuild
()
order
.
localBuild
()
self
.
tic
()
self
.
tic
()
self
.
checkStock
(
resource
,
(
self
.
workshop
,
''
,
10
))
self
.
checkStock
(
resource
,
(
self
.
workshop
,
''
,
10
))
...
...
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