Commit graph

200 commits

Author SHA1 Message Date
Ankush Menat
60efb7c2ff fix: incorrect session expiry datediff
Datediff doesn't work like this in MYSQL, mysql just treats the
timestamp as flat timestamp.
2023-06-28 17:47:22 +05:30
Ankush Menat
7c4009fde9 refactor: use QB 2023-06-28 17:47:22 +05:30
Ankush Menat
564b960678 fix: correct last update value
`NOW()` evalautes to server's time we should use system time instead.
2023-06-28 17:47:22 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Sagar Vora
4ea39d1a68
chore!: drop device support from session (#18729)
* chore!: drop device support from session

* chore: remove `session_expiry_mobile` field

* fix: remove extra `%s`
2022-12-05 16:37:32 +05:30
Ankush Menat
87092ec0b3 fix: don't attempt to delete session during read only session 2022-09-10 12:45:25 +05:30
Ankush Menat
1ec03dacff feat(UX): Disable write actions in read-only Desk
I won't be covering each and every aspect of desk that shouldn't work in
read only mode. This just handles major interactions and assumes that
user will get a hint about why other things aren't working.

Changes:
- Add read only badge on navbar.
- Disable forms
- Disable new doc creation
2022-09-09 17:34:46 +05:30
Ankush Menat
5922c0ea35 fix: dont renew session during read only mode 2022-09-08 18:22:08 +05:30
hrwx
b01929405d refactor: translatable doctypes 2022-08-05 21:38:10 +01:00
Ankush Menat
1f9a6b010a
perf: add __slots__ to most used classes (#17421)
Added slots for these classes:

- Session - Created on EACH request
- LoginManager - Created on each request
- Monitor - Created on each request if monitor is enabled (usually in
  prod setup)
2022-07-07 11:15:50 +05:30
Gavin D'souza
3871fe6cd0 perf: App Page
Reduced time taken for get_context to execute from 0.035s to 0.02s (75%
reduction)
2022-06-13 18:39:56 +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
phot0n
33b49b4d46 refactor(minor): remove is_first_startup from System Settings 2022-05-04 10:43:59 +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
barredterra
b1383df15a refactor: use is None instead of == None 2022-01-17 10:37:51 +01:00
Suraj Shetty
b6cb0fc1e7 fix: Pass SQL string of lastupdate instead of normal string
- Normal string of pypika field has additional quotes
which creates a invalid query
- `get_sql` returns column name without additional quotes
2022-01-17 10:01:29 +05:30
Aradhya
1ff3a0d517 fix: fixed sider issues 2021-12-30 19:29:02 +05:30
Aradhya
a109034ea5 fix: frappe.db.escape in query generated by frappe.qb 2021-12-30 19:15:11 +05:30
Aradhya
08d94d991f refactor: changed query in sessions 2021-11-23 15:49:16 +05:30
Aradhya
59f54aa60c refactor: changed default_ordering to keep_default_ordering 2021-11-23 15:26:15 +05:30
Aradhya
50db6d5dd4 refactor: refactored query in sessions 2021-11-23 14:47:03 +05:30
Aradhya
9ccf467acb fix: fixed no order arg in converted queries 2021-11-23 13:30:42 +05:30
Aradhya
d37aa55607 fix: fixed merged conflicts 2021-11-18 18:13:10 +05:30
Suraj Shetty
c422a72875 Merge branch 'develop' of https://github.com/frappe/frappe into sgtpepper9907-develop 2021-11-17 11:10:57 +05:30
Aradhya-Tripathi
09e7af70ab refactor: converted raw queries 2021-11-16 15:12:58 +05:30
Faris Ansari
179960d67f
Merge pull request #14134 from netchampfaris/print-format-builder-beta
feat: New Print Format Builder
2021-10-25 12:12:08 +05:30
mergify[bot]
8cbbda7ab7
Merge pull request #14441 from Aradhya-Tripathi/query-conversion
refactor: replacing raw SQL queries with frappe ORM
2021-10-22 09:00:42 +00:00
Aradhya-Tripathi
0410a88aea refactor: replaced sql_list 2021-10-22 13:31:36 +05:30
Aradhya-Tripathi
012edfe090 refactor: made style changes & fixed query conversions 2021-10-22 01:15:46 +05:30
Faris Ansari
5345d4ce7b Merge branch 'develop' of https://github.com/frappe/frappe into print-format-builder-beta 2021-10-20 18:40:18 +05:30
Sagar Vora
c560d67a57 fix: remove/update older whitelist calls 2021-10-18 16:47:11 +05:30
Aradhya-Tripathi
4ed10de918 fix: fixed sider issues 2021-10-14 23:35:52 +05:30
Aradhya-Tripathi
f5a5f97593 refactor: converted quries in sessions.py 2021-10-14 14:32:55 +05:30
Aradhya-Tripathi
7315076038 refactor: converted queries 2021-10-13 14:06:34 +05:30
Faris Ansari
f58254db78 fix: poor man's hot reload 2021-09-06 16:57:14 +05:30
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
Gavin D'souza
01d275f667 style: Format code for better readability
* Remove trailing whitespaces
* Format code to fit module conventions
* Add appropriate new lines between imports, classes, fn defs, etc
* Added comments, docstrings & module headers
2021-07-28 18:55:27 +05:30
Gavin D'souza
a02848849d Merge branch 'develop' of github.com:frappe/frappe into at-queries 2021-07-28 16:00:46 +05:30
Aradhya-Tripathi
84ff1d0af9 style: removed frappe.db.sql comments 2021-07-28 13:48:01 +05:30
Aradhya-Tripathi
538ef2168b fix: removed wrong queries 2021-07-24 22:58:12 +05:30
Aradhya-Tripathi
1204ae8ce4 fix: fixed spacing and ui tests 2021-07-23 10:45:54 +05:30
Aradhya-Tripathi
eb7e95ae26 refactor: using frappe orm 2021-07-21 19:19:06 +05:30
Gavin D'souza
42b3c17800 Revert "BREAKING CHANGE: Drop frappe.lang in favour of frappe.local.lang"
This reverts commit e00aaf8cc4.

---

This was pretty much a pointless change since frappe.lang just proxies
to frappe.local.lang
2021-07-15 16:02:44 +05:30
Gavin D'souza
f54894b1e7 chore: Update copyright year info in file header 2021-07-15 01:12:13 +05:30
Gavin D'souza
e00aaf8cc4 BREAKING CHANGE: Drop frappe.lang in favour of frappe.local.lang 2021-07-14 19:30:01 +05:30
Suraj Shetty
2d8c6c1710 Merge branch 'develop' of https://github.com/frappe/frappe into refactor-website 2021-06-03 11:43:28 +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
Suraj Shetty
68e2dfa499 Merge branch 'develop' of https://github.com/frappe/frappe into refactor-website 2021-05-20 12:57:23 +05:30
j
746c55624b Fix: session clearing query on postgres
`user` is a postgres keyword. To avoid conflict,
use table_name.user
2021-05-19 09:49:27 +05:30