My script works with DocType where the user does not have permissions. This causes the error “User _ does not have doctype access via role permission for document DocShare”
How to run Server Script as Administrator or System?
docshare = frappe.get_doc({
'doctype': 'DocShare',
'user': doc.responsible,
'share_doctype': doc.doctype,
'share_name': doc.name,
'read': 1,
'write': 1,
'share': 1,
'everyone': 0
})
docshare.insert()