-
Notifications
You must be signed in to change notification settings - Fork 249
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
Update hd_ticket.py #1556
base: main
Are you sure you want to change the base?
Update hd_ticket.py #1556
Conversation
frappe.get_value does not guarantee returned fields order from database, we have situations where values are reversed between enable_restrictions and ignore_restrictions (one's take the other field value) `value = get_list( <============== IN FRAPPE THIS DOES NOT GUARANTEE FIELDS ORDER doctype, filters=filters, fields=fields, debug=debug, limit_page_length=1, parent=parent, as_dict=as_dict, ) if as_dict: return value[0] if value else {} if not value: return return value[0] if len(fields) > 1 else value[0][0] ` fixing by reading the result
This isn't possible. Can you share a reproducible example? |
get_value internally uses get_list get_list does not guarantee fields order since they are rows in "signle" table no "order by" could be used here that is useful in single table except field name maybe this is a problem in frappe itself, since it implemented singles as one table and allowed get_value on >1 fields expecting "column" order. my solution return as_dict then fetch the fields from it. reproduce: So IT IS POSSIBLE |
@ovresko this bug should really be fixed in framework. I'll try it out. Thanks for explanation 👍 |
Fix spelling "restrictions"
frappe.get_value does not guarantee returned fields order from database, we have situations where values are reversed between enable_restrictions and ignore_restrictions (one's take the other field value)
`value = get_list( <============== IN FRAPPE THIS DOES NOT GUARANTEE FIELDS ORDER
doctype,
filters=filters,
fields=fields,
debug=debug,
limit_page_length=1,
parent=parent,
as_dict=as_dict,
)
`
fixing by reading the result