ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Unstable Permissions Problem


#1

I have simple script that does a get_doc on an Item Price. I have a user which has Sales User role and this role has Read permissions on Item Price. The problem is, SOMETIMES, the system will prompt that the user has insufficient permissions to access Item Price.

  1. Why does this happen sometimes?
  2. During the times when this happens I toggle the Read permission of the Sales User for Item Price and magically it works? - Why is there such weird behavior?

#2

Really hard to guess unless you share the full setup with screenshots


#3

Here is the capture for Item Price - Role Permissions which is pretty standard, dont think we changed anything:

Here is the user’s permissions:

Here is the script:

frappe.call({
    "method": "frappe.client.get_list",
    "args": {
        "doctype": "Item Price",
        'filters': { 
            price_list: cur_frm.get_field("buying_price_list").value, 
            item_name: item.item_code
        },
        'fields': ["name", "price_list_rate", "min_price"],
    },
    callback: function(r) {
        if(!r.exc && r.message) {
            //Process Item Price only if there is one entry
            if(!r.exc && r.message.length == 1) {
                //Push rebates to Purchase Order Item fields
                item.min_price = r.message[0].min_price;

                //Refresh the items table with the new results
                refresh_field("items");
            }
        }
    }
});

min_price is a custom field. The script is pretty simple and straightforward.

More info: To be very honest lately we’ve been getting alot of permissions related problem (typically an error message saying the user has insufficient permissions) where toggling a few of the permissions seem to solve the problem. I wonder if it is the way the system evaluates the permissions thats just gone wonky. Does anyone have any idea why it behaves this way? Has anyone experienced this lately? Or perhaps anyone knows if we patched some permissions features lately?


#4

I am ERPNext hosted user and sometimes I also faced this issue. I reported to ERPNext but didnt get proper solution as it is random issue.
I guess ERPNext still has to work on user permission part.


#5

This is still an issue for us. Sometimes I think that the permissions error is masking something else, but as this isn’t reported as full error (there’s no entry in the error log) it’s impossible to tell. Usually a reload or waiting a while fixes it but this is frustrating for our users so any solution would be greatly appreciated.


#6

Facing the same permission issue


#7