From 493c7025f5aa7c95418f4e46141a5c33dedd6ca6 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Fri, 1 Apr 2022 00:33:15 +0530 Subject: [PATCH] fix(`get_value`): make `as_dict` work for list-style filters --- frappe/database/database.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/frappe/database/database.py b/frappe/database/database.py index 511d993aa5..39c7490b83 100644 --- a/frappe/database/database.py +++ b/frappe/database/database.py @@ -446,6 +446,7 @@ class Database(object): pluck=pluck, distinct=distinct, limit=limit, + as_dict=as_dict, ) else: @@ -674,7 +675,20 @@ class Database(object): ) return r - def _get_value_for_many_names(self, doctype, names, field, order_by, *, debug=False, run=True, pluck=False, distinct=False, limit=None): + def _get_value_for_many_names( + self, + doctype, + names, + field, + order_by, + *, + debug=False, + run=True, + pluck=False, + distinct=False, + limit=None, + as_dict=False + ): names = list(filter(None, names)) if names: return self.get_all( @@ -684,7 +698,7 @@ class Database(object): order_by=order_by, pluck=pluck, debug=debug, - as_list=1, + as_list=not as_dict, run=run, distinct=distinct, limit_page_length=limit