home · contact · privacy
Turn TodoNode into full class with .as_dict, with result expand Day tests.
[plomtask] / plomtask / processes.py
index 4ff90ef7457035a6e144fbaf0764d20258de7f77..ebe781e8fb83e09699e38532c0c2c7b3a9a2e1f2 100644 (file)
@@ -34,6 +34,7 @@ class Process(BaseModel[int], ConditionsRelations):
                          ('process_step_suppressions', 'process',
                           'suppressed_steps', 0)]
     to_search = ['title.newest', 'description.newest']
+    can_create_by_id = True
 
     def __init__(self, id_: int | None, calendarize: bool = False) -> None:
         BaseModel.__init__(self, id_)
@@ -50,8 +51,9 @@ class Process(BaseModel[int], ConditionsRelations):
     def as_dict(self) -> dict[str, object]:
         """Return self as (json.dumps-coompatible) dict."""
         d = super().as_dict
-        d['explicit_steps'] = [s.as_dict for s in self.explicit_steps]
-        d['suppressed_steps'] = [s.as_dict for s in self.suppressed_steps]
+        assert isinstance(d['_library'], dict)
+        d['explicit_steps'] = [s.as_dict_into_reference(d['_library'])
+                               for s in self.explicit_steps]
         return d
 
     @classmethod