Commit graph

242 commits

Author SHA1 Message Date
Ankush Menat
28d05c41c3 fix: correct max file size in boot 2023-11-22 10:55:52 +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
Ankush Menat
4fe0a21d6b chore: limit markteplace search to prod sites 2023-09-02 16:00:17 +05:30
Rutwik Hiwalkar
3393e6d1c5
feat: search frappecloud marketplace apps from awesomebar (#22185)
* chore: remove unused import

* feat: search frappecloud marketplace apps from awesomebar

* chore: cache results and add tracking url

* refactor: get_marketplace_apps

- use generator for setting cache
- drop expiry. No need to keep this updated as of now. Site updates and
  ram usage anyways drops cache.
- Timeout if not able to respond
- Rank results lower than everything else

* chore: update request url

* fix: avoid excessive retries

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-09-02 15:57:34 +05:30
Ankush Menat
8a37d6d278
perf: reduce memory usage of background processes (#21467)
* perf: defer translation.py imports

This indirectly imports babel which isn't really required most of the
time.

* perf: defer gzip import

* perf: move validate_and_sanitize_search_inputs

This causes all sorts of indirect imports and increases memory usage

* perf: defer requests module imports

* perf: defer system settings import

* perf: defer LOG_DOCTYPES import

Causes many indirect imports

* perf: defer update_site_config

* perf: defer notifications import

* perf: remove unused import

* perf: defer safe exec import

* test: memory usage overhead
2023-06-23 12:51:45 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
81c103a741 refactor: remove form tour settings 2023-05-25 15:04:38 +05:30
Maharshi Patel
f612d84247 fix: change onboarding_status fieldtype
change onboarding_status to small text and handle null cases.
2023-05-24 15:42:16 +05:30
Maharshi Patel
05b1793fcd fix: load onboarding_tours async
loads onboarding_tours if enable_onboarding is checked and form tours are available for user.
2023-05-23 12:42:12 +05:30
Maharshi Patel
10628b9b06 feat: add onboarding and status on boot
Add List of all onboarding tours to frappe.boot and onboarding status on frappe.boot.user
2023-05-18 02:33:40 +05:30
Ankush Menat
c5f36a4979
fix(UX): workspace breadcrumbs based on history (#20529)
* fix(UX): Resolve breadcrumb conflicts from history

Same report can be part of 2 workspace, in which case use breadcrumbs
from last workspace.

* fix: make sure last workspace belongs to same module at least
2023-04-12 10:56:05 +05:30
barredterra
b2e36634d6 refactor: rename get_time_zone to get_system_timezone 2023-03-04 19:30:03 +01:00
Ankush Menat
0219eab820 fix: Dont fetch report if not permitted 2023-02-20 18:19:12 +05:30
Rutwik Hiwalkar
e9c57ee76e
revert: subscription management (#19998)
* chore: add namespaced subscription conf to boot info

* revert: https://github.com/frappe/frappe/pull/18263

* clean: remove daily hook for creating manage subscription btn
2023-02-14 12:04:28 +05:30
Ankush Menat
6dcf12d509 fix: Apply permissions on Report sidebar
Alternate to https://github.com/frappe/frappe/pull/19588

Co-Authored-By: marination <maricadsouza221197@gmail.com>
2023-02-03 18:07:21 +05:30
Ankush Menat
75d092ef7d
Revert "fix: Report sidebar must consider Permission Query" (#19921) 2023-02-03 15:13:18 +05:30
Ankush Menat
13162d8fbd fix: Only apply perm query to non-admin users 2023-01-30 11:24:16 +05:30
Gavin D'souza
81d6b282a3 chore: Remove errprint triggered by passing Query object to db.sql 2023-01-24 11:26:31 +05:30
marination
f6a68062d9 chore: Add comments to avoid incompatible queries with _run_with_permission_query 2023-01-16 19:15:16 +05:30
marination
8bd1b7b019 fix: Remove unnecessary get_sql 2023-01-16 17:09:21 +05:30
marination
2702bf60aa refactor: Use Query instead of MySQLQueryBuilder
- Use `Query` from database/utils which will consider postgres query type as well
- Reduce LOC where unnecessary

Co-authored-by: Gavin D'souza <gavin18d@gmail.com>
2023-01-16 16:51:11 +05:30
marination
0ba158979d fix: Make run_with_permission_query private (not a general util)
- Also switch query and doctype parameter positions in `_run_with_permission_query`
2023-01-13 21:30:54 +05:30
marination
c41b5e9511 fix: Report sidebar must consider Permission Query
- On boot cache permissible reports, filter out reports blocked by Permission Query
- Sidebar report selector uses boot cache to get allowed reports, which now respects Permission Query
- Convert qb query to str and append permission query and then execute

Co-authored-by: Gavin D'souza <gavin18d@gmail.com>
2023-01-13 21:23:47 +05:30
mergify[bot]
939d926b91
feat: Added Subscription Banner for remotely logging into FrappeCloud dashboard from site (backport #18263) (#18281)
* feat: Added Subscription Banner for remotely logging into FrappeCloud dashboard from site (#18263)

* feat: added Subscription Banner and Manage Subscription button

* feat[patch]: added a patch for adding `Manage Subscription` button in
navbar_settings

* chore: removed console ;)

* refactor: make the `Manage Subscription` navbar item optional

* keep it hidden by default, only show when the site configs are present

* style: prettier, isort and stuff

* chore: handling null responses, translation and refactored patch

* fix: correct index reset

* perf: reduce network/db calls

If not sys manager then why make a request?

* fix: removed network call and added subscription_expiry to boot process

* chore: added enable_manage_susbcriptions as daily background job and refactored patch

* chore: added hook to hooks.py

* this looks clean enough, also don't have insert for child tables ;)

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 68f315d372cc8c6e41f2aabda61eba0d42dcf6e4)

# Conflicts:
#	frappe/patches.txt

* chore: conflicts

* style: format

[skip ci]

Co-authored-by: Rutwik Hiwalkar <50401596+rutwikhdev@users.noreply.github.com>
2022-10-03 16:41:12 +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
hrwx
db2e898397 chore: linter fixes 2022-08-06 10:52:59 +01:00
hrwx
b01929405d refactor: translatable doctypes 2022-08-05 21:38:10 +01:00
Ankush Menat
ec8f20c097 fix: send all messages on boot instead of scanning
close https://github.com/frappe/frappe/issues/17684
2022-08-04 15:33:03 +05:30
Sagar Vora
6102c1be4e
chore: remove obsolete whitelisting from get_link_title_doctypes (#17664) 2022-07-29 12:03:06 +05:30
Suraj Shetty
6bbd8fcb32 fix: Filter notes with notify_on_login and not notify_on_every_login 2022-07-20 13:16:51 +05:30
Suraj Shetty
d5bf9b60e0 fix: Query for unseen notification 2022-07-20 10:36:40 +05:30
Ankush Menat
bea2df6dcc
perf: drop country_info from boot (#17431)
* fix: unknown function call

* perf: drop country_info from boot

This is ~50kb of data that is sent with every boot.
2022-07-07 14:41:13 +05:30
Ankush Menat
b5128a35fd
refactor: simplify fetching of readable records (#17417)
- remove encoding, use cstr directly
- remove falsy values by default None, empty string.
2022-07-07 14:40:59 +05:30
Ankush Menat
faf0d15c51 refactor: load country and currency info in boot
Previously this was done in ERPNext but all currency formatting
functionality depends on this, hence moved to framework. Largely
rewritten from scratch.
2022-07-04 20:29:38 +05:30
gavin
e92ead1257 refactor: Re-write queries using SubQuery 2022-05-27 17:32:37 +05:30
Himanshu
70409a3c7b
fix: set translated text to link field (#15451)
- Fixes [Issue/15324](https://github.com/frappe/frappe/issues/15324)
- When selecting a value for Link Field, the English text was set as link field value.
- This PR aims to fix it by setting the translated text as link field value on selection.

Todo:

- [x] Show translated text in the select dropdown
- [x] Set translated value to Link field on select
- [x] Show original value when link field is in focus
- [x] Add option to toggle this behaviour

### Behaviour

- Link field loses focus: show the translated name.
- Link field is focused
    - If old value is present
        - If options **are** one of [Role, DocType]: show the translated name
        - Else: show the name (untranslated) to enable search in untranslated values
    - Else: show what the user typed (untranslated) to enable search in untranslated values
- Value is selected: link field loses focus

## Demo

### Link to UOM in a custom Item DocType

The UOM names are in english, so the search needs to happen in english. When possible, the translation is displayed.

#### Before

https://user-images.githubusercontent.com/14891507/156415248-e5e80d05-53dc-4ca8-89c7-998986ff6e99.mov

#### After

https://user-images.githubusercontent.com/14891507/156410386-a874430c-f340-43ed-9c3a-92e8d4d50fc9.mov

### Link to DocType in Customize Form

The DocType names get translated before being searched. This is a preexisting hack in the framework for DocType and Role. In this case, we can search in the translations.

#### Before

https://user-images.githubusercontent.com/14891507/156414648-8e505f8c-9dee-4358-8182-3b358c28bb62.mov

#### After

https://user-images.githubusercontent.com/14891507/156411881-c4ca22e1-1397-4e13-9768-5e16b72f8d6d.mov

https://docs.erpnext.com/docs/v13/user/manual/en/customize-erpnext/customize-form/edit?wiki_page_patch=fdafee2715
2022-05-16 13:21:42 +00:00
Noah Jacob
1637e3af08 fix: linting 2022-04-12 21:06:59 +05:30
Noah Jacob
c2f2fc10e7 Merge branch develop into phone_field_control 2022-04-12 20:40:29 +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
Abhishek Saxena
5c8856d66e
refactor: db.sql calls to frappe.qb (#16107)
# Changes

- Introduces `subqry` class to use in where clause when there is a non-column condition. eg.
> .where(subqry(no_of_roles) == 0)
- Convert SQL queries to frappe.qb 

# Testing

Functions with query refactors
- frappe.boot.get_user_pages_or_reports() -> Same output of `get_bootinfo()` as develop
- frappe.boot.get_unseen_notes() -> Forms the same query as develop 
```sql
SELECT `name`,`title`,`content`,`notify_on_every_login`
FROM `tabNote` WHERE `notify_on_every_login`=1
AND `expire_notification_on`>'2022-03-30 01:10:53.393874'
AND (SELECT `nsb`.`user` FROM `tabNote Seen By` `nsb` WHERE `nsb`.`parent`=`tabNote`.`name`) NOT IN ('Administrator')
```
- frappe.installer._delete_doctypes() -> installed and uninsalled a dummy app to drop tables

### Not tested
- frappe.make_property_setter()
- frappe.realtime.get_pending_tasks_for_doc() [whitelist method]
- frappe.sessions.Session.start()
- frappe.twofactor.cache_2fa_data()
2022-04-12 05:07:25 +00:00
Noah Jacob
579d0643c4 Merge branch 'develop' into phone_field_control 2022-03-22 15:05:45 +05:30
Jannat Patel
55eb8eed1a fix: calling function directly from boot file 2022-03-15 09:03:37 +05:30
Suraj Shetty
5e57a9004d fix: Set value as string for property setter 2022-02-15 10:21:40 +05:30
Saqib Ansari
e2c968e255 fix: customized doctypes to show_title_field_in_link 2022-02-09 11:54:44 +05:30
Saqib Ansari
b42cc400b9 Merge branch 'develop' of https://github.com/frappe/frappe into link_title_refactor 2022-02-01 15:08:57 +05:30
phot0n
e716a55932 refactor(minor): move frequently_visited_links from (now deleted) post to route_history 2022-01-28 20:55:24 +05:30
Suraj Shetty
b180854766
Merge branch 'develop' into phone_field_control 2022-01-14 20:11:11 +05:30
Shariq Ansari
2efc917087
Merge branch 'develop' into wspace-new-design 2022-01-14 18:17:45 +05:30
Saqib Ansari
30ba577c0a Merge branch 'develop' of https://github.com/frappe/frappe into link_title_refactor 2022-01-14 15:20:56 +05:30
Saqib Ansari
b4212ad05f refactor: setting input value for link fields 2022-01-13 18:34:41 +05:30