For a custom workflow I would like to use the new conditions field (introduced in v11). We would like to allow a specific transition when all Items in a child table have a certain field set.
Some background:
DocType: RMA
RMA contains multiple Items (child table)
One workflow transition is only allowed when the field ‘Warranty’ is set to ‘Yes’ on all Items inside the child table. So the condition would be something like this:
for row in doc.items
item[row.idx].warranty = ‘Yes’
end for
This means the transition is not allowed when only a few Items are under warranty.
Is it possible to check multiple rows in a child table for a Workflow condition? If so, what would be the syntax?
This is my condition for checking if the session user is in the child table(doc.manager_list) in the form. If yes then the session user is allowed to approve the document:
[row for row in doc.manager_list if (row.user_id == frappe.session.user)]
if you are using doc.items to get items child table value, please change to doc[‘items’] or doc.get(‘items’), because items is a special reserved method.