alyf-de / erpnext_druckformate

ERPNext-Druckformate nach DIN 5008
GNU General Public License v3.0
30 stars 19 forks source link

Not permitted: insufficient permissions for Dynamic Link #6

Closed demetz closed 2 years ago

demetz commented 2 years ago

Hi,

when trying to create a delivery notice, I get a popup with the error:

grafik

Looking at delivery_note.html, I assume the following is causing my issue:

{% set company_addresses = frappe.get_list("Dynamic Link", filters={"link_doctype": "Company", "link_name": doc.company, "parenttype": "Address"}, fields=["parent"]) %}

The required address information should be available: grafik

The default delivery notice works fine for me.

demetz commented 2 years ago

this seems to be a permission issue related to frappe/erpnext and not the templates...

frappe.get_list("Dynamic Link", filters={"link_doctype": "Company", "link_name": "othermo", "parenttype": "Address"}, fields=["parent"])

FrappeException: ["Traceback (most recent call last):\n File \"apps/frappe/frappe/app.py\", line 69, in application\n response = frappe.api.handle()\n File \"apps/frappe/frappe/api.py\", line 127, in handle\n data = frappe.call(frappe.client.get_list, doctype, *frappe.local.form_dict)\n File \"apps/frappe/frappe/init.py\", line 1599, in call\n return fn(args, **newargs)\n File \"apps/frappe/frappe/client.py\", line 47, in get_list\n check_parent_permission(parent, doctype)\n File \"apps/frappe/frappe/model/db_query.py\", line 1001, in check_parent_permission\n raise frappe.PermissionError\nfrappe.exceptions.PermissionError\n"]

when printing with the admin-user of erpnext, everything works fine...

however, the user seems to have the right permissions on the company: grafik

barredterra commented 2 years ago

@demetz thanks for reporting. Please check if #7 solves your problem.

demetz commented 2 years ago

Unfortunately, that PR does not solve the issue (I believe you also have to apply it to the header-definition). Even after hardcoding the field company_address_name, I still receive the same error...

One small difference I came across: I'm on v14 beta

demetz commented 2 years ago

sorry, my bad: the PR works as expected.