Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow fetching doc fields data in API #7135

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
5 participants
@chdecultot
Copy link
Contributor

commented Mar 26, 2019

Hi,

The following PR: #6509 has added additional validations for child tables, but without taking into consideration the possibility to query the DocField child table to get the metadata linked to a particular DocType.

This PR excludes the DocField child table since the user should be able to fetch the fields corresponding to a DocType for which he/she has the correct rights.

Query example: get_list(doctype="DocField", parent="Contact", fields=["*"], filters={"parent": "Contact"}, limit_page_length=500)

@chdecultot chdecultot changed the base branch from develop to hotfix Mar 26, 2019

@jaywks

This comment has been minimized.

Copy link

commented Mar 28, 2019

@rmehta could you take a look at this? thank you very much

@sunnyakaxd

This comment has been minimized.

Copy link
Contributor

commented Mar 29, 2019

This is pretty opinionated. I would never want to expose my DocField table to rest of the world without them having System Manager role.

@rmehta

This comment has been minimized.

Copy link
Member

commented Mar 29, 2019

Yes, can you please explain the use case?

@chdecultot

This comment has been minimized.

Copy link
Contributor Author

commented Mar 29, 2019

Hi @rmehta ,

The use case is the following:

Myddleware (an open-source connector between different software), fetches all fields for a particular DocType in order to let users select which fields they want to synchronize.

Here is a screenshot of the configuration panel in Myddleware. ERPNext's fields appeared on the left before the recent change to the API:

image

Until recently we were able to fetch the different docfields for a particular doctype, but not anymore (no matter the permission level) unless I have missed an other way to fetch metadata from the API.

@sunnyakaxd, this is not exposed to the rest of the world, only to people having the rights to a particular doctype.
But if that's an issue, I can of course enforce that the requestor has a higher permission level if there is a consensus on this from the core team.

Thanks guys!

@sunnyakaxd

This comment has been minimized.

Copy link
Contributor

commented Apr 1, 2019

You can use following api:

doctype: <Doctype>
with_parent: 1
cmd: frappe.desk.form.load.getdoctype

It returns fields as well. And this also has access control built in.

@stale

This comment has been minimized.

Copy link

commented May 1, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within a week if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

@stale stale bot added the inactive label May 1, 2019

@stale stale bot closed this May 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.