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
137
Merge Requests
137
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
178e2673
Commit
178e2673
authored
Nov 18, 2015
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hooks before/after edit when migrating Simulation Tree to New Simulation.
parent
2eef22ee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
product/ERP5/Document/AppliedRule.py
product/ERP5/Document/AppliedRule.py
+15
-4
No files found.
product/ERP5/Document/AppliedRule.py
View file @
178e2673
...
...
@@ -170,8 +170,12 @@ class AppliedRule(XMLObject, ExplainableMixin):
"""
return
self
.
objectValues
(
portal_type
=
RuleMixin
.
movement_type
)
def
_migrateSimulationTree
(
self
,
get_matching_key
,
get_original_property_dict
,
root_rule
=
None
):
def
_migrateSimulationTree
(
self
,
get_matching_key
,
get_original_property_dict
,
root_rule
=
None
,
hook_before_edit
=
None
,
hook_after_edit
=
None
):
"""Migrate an entire simulation tree in order to use new rules
This must be called on a root applied rule, with interaction workflows
...
...
@@ -348,12 +352,19 @@ class AppliedRule(XMLObject, ExplainableMixin):
kw
[
'quantity'
]
=
quantity
-
old
.
pop
(
'quantity'
)
if
new
!=
old
or
sm
.
quantity
!=
quantity
:
raise
NotImplementedError
# quantity_unit/efficiency ?
else
:
recorded_property_dict
.
update
(
new
)
if
hook_before_edit
is
not
None
:
hook_before_edit
(
rule
,
old_sm
,
sm
,
edit_kw
,
recorded_property_dict
)
if
recorded_property_dict
:
sm
.
_recorded_property_dict
=
PersistentMapping
(
recorded_property_dict
)
sm
.
_edit
(
**
edit_kw
)
if
hook_after_edit
is
not
None
:
hook_after_edit
(
rule
,
old_sm
,
sm
)
old_dict
[
sm
]
=
old_sm
sm
=
None
deleted
=
old_dict
.
items
()
...
...
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