I have been using viewflow for a while, and I managed to create my process without any problem.
But now I need someone to review the work from someone else. I don't want to create roles for that simple task, because I want everybody to be able to review somebody's work at any time. In other words, there is one task (task1) that can be executed for everybody, but it cannot be executed for the same person that finished the previous task.
task1 = (
flow.View(
UpdateProcessView,
fields=["quality_check", "quality_check_comments"],
task_description="writte comments"
).Permission(
auto_create=True
).Next(this.task2)
)
task2 = (
flow.View(
UpdateProcessView,
fields=["quality_check_completed"],
task_description="Perform a quality control on the work instructions"
).Permission(
auto_create=True
).Next(this.check_qa_manual)
)
From
Django-viewflow how to get the current user? I understand that I can assign the task to the user that created the task or the owner of a previous task, but I want the contrary. Is there a way to say .Assign(this.start.(not)owner)
or .Assign(this.start.(not)created_by)
?
You could implement custom callable for the user selection.
.Assing
accepts a callable that should take a process activation and return a user instance, ex
flow.View(...).Assign(lambda act: User.objects.filter(...).first())
https://github.com/viewflow/viewflow/blob/master/demo/shipment/flows.py#L57