Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
350b0cf7
Commit
350b0cf7
authored
Sep 28, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simulation: fix typos and add a few comments to AppliedRule._migrateSimulationTree
parent
c601fdf1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
product/ERP5/Document/AppliedRule.py
product/ERP5/Document/AppliedRule.py
+12
-6
No files found.
product/ERP5/Document/AppliedRule.py
View file @
350b0cf7
...
...
@@ -179,7 +179,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
- All related simulation trees are properly indexed (due to use of
isSimulated). Unfortunately, this method temporarily unindexes everything,
so you have to be careful when migrating several trees at once.
- All simulation trees it may depend on are already migrated. It is advi
c
ed
- All simulation trees it may depend on are already migrated. It is advi
s
ed
to first migrate all root applied rule for the first phase (usually
order) and to continue respecting the order of phases.
...
...
@@ -208,10 +208,11 @@ class AppliedRule(XMLObject, ExplainableMixin):
for
history_item
in
workflow
.
getInfoFor
(
delivery
,
'history'
,
()):
if
history_item
[
'simulation_state'
]
in
draft_state_list
:
continue
# Delivery is/was not i
s
draft state
# Delivery is/was not i
n
draft state
resolveCategory
=
portal
.
portal_categories
.
resolveCategory
order_dict
=
{}
old_dict
=
{}
order_dict
=
{}
# {new_sm: {key: [old_sm]}}
old_dict
=
{}
# {root_delivery_line_relative_url: {key: [old_sm]},
# new_sm: old_sm}
# Caller may want to drop duplicate SM, like a unbuilt SM if there's
# already a built one, or one with no quantity. So first call
# 'get_matching_key' on SM that would be kept. 'get_matching_key' would
...
...
@@ -233,13 +234,18 @@ class AppliedRule(XMLObject, ExplainableMixin):
x
.
sort
(
key
=
sort_sm
)
sm_dict
.
setdefault
(
k
,
[]).
extend
(
x
)
for
x
in
x
:
r
=
{}
# Group AR by rule.
r
=
{}
# {rule: [[sm]]}
for
x
in
x
.
objectValues
():
sm_list
=
x
.
getMovementList
()
if
sm_list
:
r
.
setdefault
(
x
.
getSpecialise
(),
[]).
append
(
sm_list
)
# For each rule...
for
x
in
r
.
values
():
if
len
(
x
)
>
1
:
# There were several AR applying the same rule.
# Choose the one with a built SM (it will fail if
# there are several such AR), fallback on the first.
x
=
[
y
for
y
in
x
if
any
(
z
.
getDelivery
()
for
z
in
y
)]
or
x
[:
1
]
x
,
=
x
...
...
@@ -264,7 +270,7 @@ class AppliedRule(XMLObject, ExplainableMixin):
'recursiveImmediateReindexObject'
,
'recursiveImmediateReindexSimulationMovement'
)):
raise
ConflictError
# Do not try to keep simulation tree for draft delivery
# Do not try to keep simulation tree for
a
draft delivery
# if it was already out of sync.
if
delivery
.
getSimulationState
()
in
draft_state_list
and
\
any
(
x
.
getRelativeUrl
()
not
in
old_dict
...
...
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