Conditional Workflow (SyntaxError: invalid syntax)

I encountered an error while implementing conditions in the workflow for the below code.

Anyone please help me resolve this issue?

getbom = frappe.get_doc(“BOM”, doc.get(‘bom_no’))
bom_item_codes = [item.item_code for item in getbom.get(‘items’)]
workorder_item_codes = [item.item_code for item in doc.get(‘required_items’)]
all(item_code in bom_item_codes for item_code in workorder_item_codes)

File “”, line 1
getbom = frappe.get_doc(“BOM”, doc.get(‘bom_no’))
^
SyntaxError: invalid syntax

It seems there may be an indentation error. Please correct it.

1 Like

There is no indentation error, but the get_doc function is not being allowed. Can you suggest code to cross-check the items in the work order with BOM items?

getbom = frappe.get_doc(“BOM”, doc.get(‘bom_no’))
bom_item_codes = [item.item_code for item in getbom.get(‘items’)]
workorder_item_codes = [item.item_code for item in doc.get(‘required_items’)]
all(item_code in bom_item_codes for item_code in workorder_item_codes)

Create a custom checkbox field in work order.
Write a server script to implement this logic, and it it’s true, set that checkbox as 1.

Check for the value of that checkbox in the workflow.

Thank you for your assistance. But,we don’t want to add a field in the Work Order; we want to handle it directly through the Work Order itself.