Bar Code Scanner

Dear Experts,
I have developed a custom doctype that consists of fields like Item code which is linked to item master and the corresponding bar code. When I scan the bar code using ERPNext mobile app via that field, I want to trigger the validate event in the python/js controller.

How can I achieve this Majic?

Thanks and stay safe.