How to pass the value one child doctype to another child doctype based on if condition

I am using two child doctype. The value passed successfully. But i want to restrict the data using if condition. for example… if(status==‘Accepted’) so the accepted field values only passed into the another child doctype…

This is my code.

@frappe.whitelist()
def make_quality(source_name, target_doc=None):
doc = get_mapped_doc(“Quality Inspection”, source_name, {
“Quality Inspection”: {
“doctype”: “Stock Entry”,
“validation”: {
“docstatus”: ["=", 1]
}
},
“Quality Inspection Item”: {
“doctype”: “Stock Entry Detail”,
“field_map”: {
“stock_qty”: “transfer_qty”,
“batch_no”: “batch_no”
},
}
}, target_doc)
return doc