fix: typerror on tree doctypes - Item Group, Customer Group, Supplier Group and Territory (#38870)
* refactor: typerror on set_root_readonly
* refactor: remove 'cur_frm' usage in supplier_group
* refactor: remove 'cur_frm' usage in territory.js
* refactor: remove 'cur_frm' from sales_person.js
(cherry picked from commit 6d5bdc6c68)
Co-authored-by: ruthra kumar <ruthra@erpnext.com>