Insufficient Permission for GL Entry

I tried to cancel and delete Settlment through server side script, and have GL Entry to be cancel first but somehow it showed

Insufficient Permission for GL Entry for certain user even though I already set permission to that user’s role. How to fix this?

@Clarisa_Valentin share a screenshot


i tried to do this in my custom settlement

gl_list = frappe.get_all("GL Entry", {"voucher_no": self.journal_entry})
            if gl_list:
                for i in gl_list:
                    gl = frappe.get_doc("GL Entry",
                    if gl.docstatus == 1:

            je = frappe.get_doc("Journal Entry", self.journal_entry)
            if je.docstatus == 1:

@Clarisa_Valentin and the permissions

permissions for settlement and gl entry

i want to do this with the role admin district

@Clarisa_Valentin is there any restrictions in the user permissions page ?

No there isn’t. I tried it in my localhost and it worked, but not on production