I created a number card with a custom type, but it is only visible to users with System Manager permissions. How can I make the number card accessible to all users? The “Is public” checkbox is checked in Number Card Definition.
The number card type is a custom type, so it shouldn’t require doctype permissions since I’m using a direct SQL query, which bypasses the permission manager settings. Here’s the relevant part of the code— what might I be overlooking?
def get_fb_opening_checklist_audit_yes(branch_param, current_date):
build_sql = """
SELECT
count(*) as count
FROM
`tabFB Opening Checklist` coc
JOIN
`tabFB Opening Checklist Child` cocc
ON
coc.name = cocc.parent
AND
cocc.audit = 1
"""
where_cond_date = f" DATE(coc.date) = '{current_date}'"
where_cond_branch = f" coc.branch = '{branch_param}'"
build_sql = f"{build_sql} WHERE {where_cond_date} AND {where_cond_branch}"
print(build_sql)
data = frappe.db.sql(build_sql, as_dict=True)
check_rec_exists = len(data)
print('check_rec_exists', check_rec_exists)
audit_yes_count = 0
if (check_rec_exists > 0):
audit_yes_count = data[0].count
return audit_yes_count
The debugging revealed that the Python code wasn’t called at all.
I discovered a solution, but it seems to be a bug.
After switching from Custom to Document Type and assigning the doctype used in the custom SQL, I saved it (screenshot 1) and then immediately switched back to Custom (screenshot 2). This process made the document column display the doctype as shown in the following screenshot (screenshot 3).
Additionally, I removed the System Manager permission for the user (screenshot 4). Now the Number card appears without any issues (screenshot 5).