Commit graph

429 commits

Author SHA1 Message Date
Ankush Menat
64c221343e
perf: skip ifnull checks on modified field (#24042) 2023-12-30 06:39:32 +00:00
Ankush Menat
0fd6f5eed7
Merge pull request #23827 from frappe/api-docs
docs: add Python API missing docstrings / type hints
2023-12-21 12:13:05 +05:30
bourouffala
3015852ce1
fix: Error when displaying dashboard with number card using average and sum functions (#23883) 2023-12-20 11:13:20 +00:00
Ankush Menat
5deabdde21 fix: skip virtual fields in perm level checks during DB Query
DB Query can't access virtual fields so it should ignore all virtual
fields.
2023-12-20 12:00:08 +05:30
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Ankush Menat
687752359d
perf: Primary key is never nullable (#23788)
People ususally write queries like these...

```
frappe.get_all(doctype, {"name": ("in", list_of_docs))
```

Ocassionally, the `list_of_docs` is empty because it's dynamically
generated and in this case we end up doing full table scan to find... nothing!
2023-12-14 15:01:19 +00:00
Smit Vora
f62f4472e6
fix: ignore if controller doesn't have get_list attr (#23736) 2023-12-11 23:24:00 +05:30
barredterra
c35476256f refactor: simplify conditional logic
Command: `sourcery review --fix --enable de-morgan .`
2023-12-05 11:14:41 +01:00
Akhil Narang
731c5c8cd5
refactor(db_query): check for docfield not_nullable
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
15c925ccc7
feat: check for docfield not_nullable property to decide whether a field can be nullable
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Akhil Narang
390d4e1b13
chore: drop unused variables and parameters
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-16 14:51:57 +05:30
Ankush Menat
385fa8aaef
fix!: Correct between filtering (#22918)
* fix: Remove incorrect fallback

If you do +1 on date it will also start considering next date. This was
only done to accomodate date filter on datetime fields. Which also
doesn't really work.

* refactor: simplify fieldtype detection

* fix!: Correct datetime fallbacks for between filters

* chore: remove unncessary test

This is very specific and introduces flake when the job tests run before
it.
2023-10-26 06:23:14 +00:00
barredterra
88c8baa9ee refactor: for append to extend, merge list extend
Replace a for append loop with list extend.
Create the list with values instead of creating
an empty list and extending it with another list.
2023-08-09 13:25:39 +02:00
Shariq Ansari
e1c1e256ef
Merge pull request #21798 from pps190/frappe/fix/ambigus-table-join 2023-07-28 12:28:04 +05:30
Ankush Menat
8930d4b5e1
perf: drop ifnull from IS SET filter (#21822)
- Kinda confuses query planner (idk why it's not smart enough to
  understand but there are probably edge cases where it can't be done)
- `null != null` and `'' != null` both yield `null` which is falsy and
  won't be shown in results.

Alternate fix to https://github.com/frappe/frappe/pull/21817
2023-07-27 10:58:20 +05:30
Devin Slauenwhite
7a3e7b7eb2 Merge remote-tracking branch 'frappe/develop' into frappe/fix/ambigus-table-join 2023-07-24 14:23:28 -04:00
Ankush Menat
2c99583247 perf: Lazily fetch shared documents
We eagerly fetch shared documents for ANY `get_list` query, even when
user has full read acess doctype, where it's moot to consider adding
shared document as separately.

This eliminates one entire db call from get_list and in most cases
get_list will translate to single DB call, hence probably worth the
additional complexity.
2023-07-22 18:04:35 +05:30
Devin Slauenwhite
b9b3a250f8
Merge branch 'develop' into fix-ambigus-table-join 2023-06-06 10:29:59 -04:00
Ankush Menat
3df13ca392 feat: new operator - descendants of (inclusive)
Co-Authored-By: Faris Ansari <netchamp.faris@gmail.com>
2023-05-29 16:59:57 +05:30
Gavin D'souza
63a605876f fix: Pass current dt as fallback parent_doctype 2023-04-27 14:37:15 +05:30
Gavin D'souza
a22cbe8ae5 fix: Setup permission_map & use get_permitted_fields 2023-04-22 14:58:28 +05:30
Devin Slauenwhite
f17e52088f chore: linter 2023-03-03 11:59:05 -05:00
Devin Slauenwhite
1c86d6431f fix: don't join on parenttype 2023-03-03 11:46:57 -05:00
Devin Slauenwhite
943a49aabc fix: perm check on alias table name 2023-03-03 11:28:36 -05:00
Devin Slauenwhite
160f0b65fb
Merge branch 'develop' into fix-ambigus-table-join 2023-03-03 09:44:29 -05:00
Sagar Vora
70ede18942
fix: improved implementation of between filter (#20190) 2023-03-02 09:51:02 +05:30
Sagar Vora
e0d7c9d901
chore: remove dead helper function (#20191) 2023-03-01 12:05:30 +05:30
gavin
3406b6d752
fix(db_query): selecting linked fields as alias (#20085)
* fix(db_query): Don't track link_tables separately

Treat all joined tables the same, expand the fieldnames whether Table or
Link type with their respective table names

* fix(db_query): Add link join conditions for all relevant fields

* Revert "fix(db_query): Add link join conditions for all relevant fields"

This reverts commit 79622ab4cea5aa73a24f4ba7afde8e83510a79fb.

* Revert "fix(db_query): Don't track link_tables separately"

This reverts commit b8364f781e52e7ffaa7faa8878ef409b023f2288.

* fix: Check link field tables permissions in permlevel checks

* test: Fix, add for test_permlevel_fields

Previous assertion was wrong :')
added extra to check if access is fine
2023-02-22 22:14:15 +05:30
Devin Slauenwhite
d5ce94d6a5
feat: disable comment count on list view settings. (#20039)
* feat: add list view setting disable column count.

* fix: cast using sbool

* fix: make modified last-child if comment_count is disabled.
2023-02-22 18:17:45 +05:30
Suraj Shetty
044eec35a6 fix: Do not filter columns like "_assign" & "_user_tags" 2023-02-14 14:00:42 +05:30
Gavin D'souza
5829dabf74 fix: Add DefaultValue to core_doctypes_list 2023-02-06 12:45:02 +05:30
Gavin D'souza
da3b98c91a Merge branch 'develop' into distinct-get_count 2023-02-03 20:26:21 +05:30
Ritwik Puri
d118cfb94a fix: Pass parent_doctype to fetch permitted fields in child tables 2023-02-03 20:20:00 +05:30
Gavin D'souza
0c17d400c0 fix(db_query): Handle distinct in fn calls 2023-02-03 20:12:55 +05:30
Gavin D'souza
3cd781e316 Merge branch 'develop' into get_all-virtual-dts 2023-02-02 13:55:24 +05:30
Gavin D'souza
5d3453eeb9 refactor: Re-use DefaultOrderBy value as global constant 2023-02-02 13:43:31 +05:30
Gavin D'souza
7ce0c4c8b3 Merge branch 'develop' into permlevel-apis 2023-01-31 17:47:59 +05:30
Gavin D'souza
dc940bac1d fix: Pass all DatabaseQuery.execute params to virtual doctype's get_list
Give parsed args higher priority in kwargs resolution
2023-01-31 17:07:04 +05:30
Gavin D'souza
9d236fc2cc fix: handle missing is_virtual column via is_virtual_doctype 2023-01-31 15:31:24 +05:30
gavin
7f34d510f2
fix(db_query): Allow link field to have 'tab' (#19820)
* fix(db_query): Allow link field to have 'tab'

Issue: Occurence of tab was used to check if the selected field is a table name
and not a fieldname. This caused DocTypes with fields like `tablets` or
`table_name` to break List Views.

Change: Check if the field exists in meta to be sure that the selectable
is a field.

* fix: Split once to ensure at most 2 args
2023-01-31 14:43:26 +05:30
Gavin D'souza
5cc21da6a1 fix: Interface DatabaseQuery to virtual doctypes' 2023-01-31 13:06:44 +05:30
Leonard Goertz
3e20e7df25
fix: add brackets for docshare or condition (#19650)
Co-authored-by: Leonard Goertz <leonard.goertz@noventive.com>
2023-01-30 14:14:11 +05:30
Gavin D'souza
31049b705e fix(db_query): With as_list, pass NULL to maintain order 2023-01-25 14:01:02 +05:30
Gavin D'souza
895f1d3f3a fix(db_query): Check if params in sql fn call are all permitted access 2023-01-25 12:45:36 +05:30
Gavin D'souza
6b0e4695a8 Merge branch 'develop' into permlevel-apis 2023-01-25 12:08:47 +05:30
Gavin D'souza
4c1b2ae67c refactor: get_valid_dict
* Util get_permitted_fields checks for valid columns instead of planned logic
* Remove virtual field from dict if not in permitted fields
* Remove reliance on sentinel object _DOC_DELETED_ATTR
2023-01-25 12:04:34 +05:30
Gavin D'souza
e75bfd0e73 refactor: Split objects just once
Co-authored-by: Ritwik Puri <ritwikpuri5678@gmail.com>
2023-01-25 10:45:30 +05:30
Gavin D'souza
d357af1533 refactor: Add a maxsplit limit to string splits 2023-01-24 19:22:51 +05:30
Gavin D'souza
e41f005daa fix(db_query): Remove naive field in sql func check 2023-01-24 13:59:48 +05:30
Gavin D'souza
2ae6b7f016 fix: Handle * fields after field iterations 2023-01-24 13:52:33 +05:30