Question:how to change parent script to be work on child?

hi
i have this script on purchase Invoice.js
frm.fields_dict.cash_bank_account.get_query = function(doc) {
return {
filters: [
[“Account”, “account_type”, “in”, [“Cash”, “Bank”]],
[“Account”, “is_group”, “=”,0],
[“Account”, “company”, “=”, doc.company],
[“Account”, “report_type”, “=”, “Balance Sheet”]
]
}
}

which i need is to do the same work on other custom child table eg:A.
which is child table in Doctype eg:B

so how to make this script in DocType B.js?

Refer to the following guide, It will help you gain a general understanding of scripts: