Commit graph

76 commits

Author SHA1 Message Date
Aditya Patil
0cdeee51ab refactor: linked documents retrieval and UX 2026-02-23 18:58:12 +05:30
Aarol D'Souza
68727cbd61
fix: add type hints to whitelisted methods 4 (#37204)
* fix(utils): add type hints to whitelisted methods

* fix(desktop): add type hints to whitelisted methods

* fix(listview): add type hints to whitelisted methods

* fix(access_log): add type hints to whitelisted methods

* fix(setup_wizard): add type hints to whitelisted methods

* fix(notification_settings): add type hints to whitelisted methods

* fix(calendar): add type hints to whitelisted methods

* fix(notifications): add type hints to whitelisted methods

* fix(query_report): add type hints to whitelisted methods

* fix(load): add type hints to whitelisted methods

* fix(save): add type hints to whitelisted methods

* fix(user): add type hints to whitelisted methods

* fix: correct Document import

* fix(list_view_settings): add type hints to whitelisted methods

* fix(reportview): add type hints to whitelisted methods

* fix(treeview): add type hints to whitelisted methods

* fix(linked_with): add type hints to whitelisted methods

* fix(bulk_update): add type hints to whitelisted methods

* fix(assign_to): add type hints to whitelisted methods

* fix(workspace): add type hints to whitelisted methods

* fix(kanban_board): add type hints to whitelisted methods

* fix(event): add type hints to whitelisted methods

* fix(email): add type hints to whitelisted methods

* fix(exporter): add type hints to whitelisted methods

* fix(permission_manager): add type hints to whitelisted methods

* fix(dashboard_chart): add type hints to whitelisted methods

* fix(number_card): add type hints to whitelisted methods

* fix(tag): add type hints to whitelisted methods

* fix: add hook to force type hints on all whitelisted endpoints

* fix: target_doc can be dict/json string

* fix: doc can be dict/json string

* fix(tests): add type hints to whitelisted methods in test

* fix: tree method is optional

* test: Fix test api types

* chore: drop dead code

* fix: document can be int

* fix: Number card input can be document

As utils in some other API calls

* fix: Always use session user

The only usage of this API that makes sense.

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankush@frappe.io>
2026-02-20 14:53:08 +05:30
Aarol D'Souza
cf69e4bed1
fix(postgres): misc query building fixes + CI (#34831)
* fix(query): check standard field definitions

Signed-off-by: Akhil Narang <me@akhilnarang.dev>

* fix(postgres): fix order_by problem in pg

* fix(postgres): fix order_by in get_all for _test_connection_query

* fix: add check to a proper numeric fallback in _get_ifnull_fallback

* test(postgres): fix pg query used in assertion in test_permission_query

* fix(postgres): fix order_by in get_all for possible_link

* fix(postgres): fix order_by in get_all for set_modules

* fix(postgres): fix pg query count *

* fix(postgres): fix order_by in get_all for ask_pass_update

* fix(postgres): fix order_by statement in search_widget

* fix(postgres): fix order_by in get_list for get_stats

* test(postgres): normalize_sql for pg queries in test_arithmetic_operators_in_fields

* test(postgres): normalize_sql for pg queries in test_field_alias_in_group_by

* test(postgres): normalize_sql for pg queries in test_field_alias_permission_check

* test(postgres): fix order_by statement in get_all for test_db_keywords_as_fields

* test(postgres): fix order_by statement in get_all for test_prepare_select_args

* fix(treeview): use 0 instead of false to check since check field is an integer

* fix(postgres): fix order_by in get_all for sync_communication

* fix(postgres): fix order_by in get_all for get_references_across_doctypes_by_dynamic_link_field

* test(postgres): fix order_by in get_all for test_list_summary

* fix(postgres): fix order_by in get_all for email queries

* test(postgres): use order_by none and update assertion for postgres

* fix(postgres): use ILIKE to support case insensitive search in postgres

* test(test_query): update pg specific query assert to use ILIKE

* test(test_query): update test_nested_filters to use ilike instead for PG

* test(postgres): update pg query in assert to test updated qb query

* fix(search): update query to be db-agnostic

* test(postgres): normalize query for pg in test_build_match_conditions

* fix(postgres): suppress ORDER BY when SELECT DISTINCT in query for postgres specific behavior

* fix(postgres): suppress ORDER BY when GROUP BY is explicitly asked for pg specific behavior

* test(postgres): fix test behavior for pg ORDER BY drop when used with GROUP BY

* refactor: reducing noise in code by formatting code

* fix(query): use Star() to handle SQL wildcard character * correctly

* fix(postgres): display warning for ORDER BY fields that will be dropped

---------

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
2025-12-05 10:30:49 +05:30
Akhil Narang
df5080b45e
fix(linked_with): don't add tab prefix
query builder takes care of this

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-11-19 21:15:57 +05:30
Akhil Narang
6ca4d4d167
refactor(treewide): ruff format
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-09-26 13:16:43 +05:30
Aayush Dalal
ca5b4cea0b
fix: throw permission error (#32860) 2025-06-10 08:47:49 +05:30
Ejaaz Khan
2e0db2d69e fix: Module not found error for custom doctypes 2025-04-25 14:51:16 +05:30
sokumon
d943c9e463 fix: dont skip if any record is present 2025-02-23 19:49:41 +05:30
sokumon
78df15970c fix: add check for child doctype if it has a valid parent 2025-02-23 00:59:03 +05:30
Akhil Narang
80d20ff745
fix(get_linked_docs): check if user can read doctype before fetching a list
Users might not have access to all the possible linked doctypes - they should still be able to access the others

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-02-12 18:34:43 +05:30
Deepesh Garg
5f31ffcc54 chore: linting issues 2025-01-06 17:55:28 +05:30
Deepesh Garg
d2e4d63c8f fix: Ignoring linked doctypes on cancel 2025-01-03 18:23:20 +05:30
Gavin D'souza
cdacca91a6
refactor: get_linked_docs
- Cleaner logic flows
 - Better variables naming & use of standard/cleaner APIs
 - Use get_list to show only permitted docs
2024-06-27 13:39:00 +02:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
8a71054c0c
Merge pull request #24765 from ankush/black_to_ruff
ci: switch to ruff-format
2024-02-05 19:20:51 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Ankush Menat
b6eef6ebc2
fix: Skip virtual doctypes in link field checks (#24759) 2024-02-05 18:04:31 +05:30
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Ankush Menat
6926669577 perf: Ignore amended_from link fields in link field checks
Small perf benefit at not much cost. `amended_from` are *always*
refererring to cancelled documents so there's no need to check these
fields.
2023-10-31 15:03:08 +05:30
Ankush Menat
440612f3b9
fix: Check perms before sharing linked docs (#22783) 2023-10-17 18:53:09 +05:30
Ankush Menat
018ed845bd refactor: defer unnecessary json-dumping of messages
Also avoid accessing locals where interface is present like for popping last message.
2023-10-16 18:13:50 +05:30
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
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Shariq Ansari
da6809ec09
revert: checking if user has permission to meta (#19485) 2023-01-05 13:47:14 +05:30
Ankush Menat
025906840d
perf: remove order_by from linked_with checks (#19229) 2022-12-12 15:39:46 +05:30
Sagar Vora
b1703117fc
chore: remove unused whitelisting from API (#19000) 2022-11-25 11:59:04 +05:30
Ankush Menat
2eec621e95 chore: db.get_all -> get_all
Reduces 1 pointless function call.
Function calls are also not "super cheap" in python.
2022-08-22 11:35:14 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Gavin D'souza
39fc90cb5b fix(ux): Pop from message_log if DoesNotExistError 2022-03-07 16:35:53 +05:30
Gavin D'souza
38fbe76ebf fix: Eliminate broken & impermissible links from get_linked_docs 2022-03-07 15:50:17 +05:30
Gavin D'souza
6edb1f09e4 refactor: Fetch Linked Documents in single request ;)
This action was broken into some heavy UI stuff that seems to be handled
from the current UI from what I can tell and a request triggered from
the Desk for every suspected linked document (talk about self DOS xD)

Removed long dead with_doctype option in get_linked_docs API. How do i
know it's been long dead? I've not come across code that won't very
obviously break when hit with any non None value.
2022-03-07 15:02:20 +05:30
phot0n
b31f3c24f6 refactor: remove parent, parenttype, parentfield, idx columns from non-child table doctypes
* feat: add parent, parenttype, idx, parentfield columns to doctypes when transitioning from normal -> child table

* fix: remove parent, parenttype, parentfield, idx from DocType DocType
2022-02-07 15:12:37 +05:30
Rucha Mahabal
d56fea4a47 fix: use get_all instead of get_list while fetching linked doctypes 2021-12-16 09:11:21 +05:30
Subin Tom
2b8328715e
fix: Sales invoice cancellation error due to get_list (#15243)
* fix: Sales invoice cancellation error due to get_list

* fix: missed out one `get_list`
2021-12-10 07:51:27 +00:00
Suraj Shetty
615db9b55e style: Fix sider alerts 2021-11-28 09:44:05 +05:30
Suraj Shetty
3b276df7c1
Merge branch 'develop' into refactor-linked-with 2021-11-03 11:13:53 +05:30
Ankush Menat
af4ce8156d
fix: remove mutable defaults (#14597)
* fix: mutable defaults

* fix: missing defaults
2021-10-28 09:36:31 +00:00
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
leela
8a8fbad0f3 refactor: getting submitted linked reference docs 2021-08-30 12:34:21 +05:30
Gavin D'souza
793b5638d3 style: Fix E201, E202, E401, E701
reported by sider: https://sider.review/gh/repos/1864194/pulls/13344?statuses#issues
2021-05-27 12:48:01 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Ankush Menat
d25909c799
fix: ZeroDivision error in progress
When list of docs is of same length as list of doctypes to ignore, the
formula would throw ZeroDivision error. It's meaningless to subtract
these two quantities hence removed it.

Showing accurate progress bar would require pre-computing number of docs
to be cancelled, which is unnecessary.

Related issue: ISS-20-21-10442
2021-03-17 10:08:50 +05:30
Ankush Menat
fb1eac23c5
docs: update docs for linked_with functions 2021-03-16 11:49:37 +05:30
Anurag Mishra
6bfd07be51
feat: Ignore doctypes for cancel_all (#11034) 2020-08-14 16:12:02 +05:30
Prssanna Desai
20815aa349
refactor: remove unnecessary code from get_submitted_linked_docs (#10844)
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
2020-06-30 08:03:28 +05:30
Anand Narayan
fc69f77f73 fix(linked_docs): infinite recursion due to loops 2020-06-27 22:05:24 -07:00
mergify[bot]
4f6f9f3293
fix: check for self linking (bp #10181) (#10426) 2020-05-20 23:30:27 +05:30
mergify[bot]
0826a9db45
fix: check for self linking and circular linking while getting submitted linked docs (bp #10179) (#10425) 2020-05-20 21:24:09 +05:30