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
Binh
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):
...
@@ -170,8 +170,12 @@ class AppliedRule(XMLObject, ExplainableMixin):
"""
"""
return
self
.
objectValues
(
portal_type
=
RuleMixin
.
movement_type
)
return
self
.
objectValues
(
portal_type
=
RuleMixin
.
movement_type
)
def
_migrateSimulationTree
(
self
,
get_matching_key
,
def
_migrateSimulationTree
(
self
,
get_original_property_dict
,
root_rule
=
None
):
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
"""Migrate an entire simulation tree in order to use new rules
This must be called on a root applied rule, with interaction workflows
This must be called on a root applied rule, with interaction workflows
...
@@ -348,12 +352,19 @@ class AppliedRule(XMLObject, ExplainableMixin):
...
@@ -348,12 +352,19 @@ class AppliedRule(XMLObject, ExplainableMixin):
kw
[
'quantity'
]
=
quantity
-
old
.
pop
(
'quantity'
)
kw
[
'quantity'
]
=
quantity
-
old
.
pop
(
'quantity'
)
if
new
!=
old
or
sm
.
quantity
!=
quantity
:
if
new
!=
old
or
sm
.
quantity
!=
quantity
:
raise
NotImplementedError
# quantity_unit/efficiency ?
raise
NotImplementedError
# quantity_unit/efficiency ?
else
:
recorded_property_dict
.
update
(
new
)
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
:
if
recorded_property_dict
:
sm
.
_recorded_property_dict
=
PersistentMapping
(
sm
.
_recorded_property_dict
=
PersistentMapping
(
recorded_property_dict
)
recorded_property_dict
)
sm
.
_edit
(
**
edit_kw
)
sm
.
_edit
(
**
edit_kw
)
if
hook_after_edit
is
not
None
:
hook_after_edit
(
rule
,
old_sm
,
sm
)
old_dict
[
sm
]
=
old_sm
old_dict
[
sm
]
=
old_sm
sm
=
None
sm
=
None
deleted
=
old_dict
.
items
()
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