mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Pamhyr2: Create new generic methode '_data_traversal' for scenario duplicattion.
This commit is contained in:
1 parent
591cd8950c
commit
8173eb8de9
5 files changed
+57
-24
No files matched your search
@@ -502,3 +502,18 @@ class Study(SQLModel):
|
||||
self.status.set_as_read_only()
|
||||
else:
|
||||
self.status.set_as_editable()
|
||||
|
||||
def duplicate_current_scenario(self):
|
||||
source = self.status.scenario_id
|
||||
new = self.scenarios.new(
|
||||
self.status.scenario.parent
|
||||
)
|
||||
|
||||
self.river._data_traversal(
|
||||
predicate=lambda obj: obj._owner_scenario == source,
|
||||
execute=lambda obj: obj.set_owner_scenario(),
|
||||
data={}
|
||||
)
|
||||
|
||||
self.status.set_as_editable()
|
||||
return new
|
||||
Reference in new issue
Block a user