Commit graph

2127 commits

Author SHA1 Message Date
Ankush Menat
442060a96a
Merge pull request #17150 from ankush/bulk_object_inserts
feat: bulk insert simple Docs and iterator support for db.bulk_insert
2022-11-29 13:33:25 +05:30
Ankush Menat
a6af1ed542 feat: bulk insert simple Document objects 2022-11-28 15:32:20 +05:30
gavin
6062d812a1
fix(db_query): Disallow usage of certain functions in *_by (#18981)
* fix(db_query): Disallow blacklisted functions in (order|group)_by

Changes:
- allow only functions that are not blacklisted in *_by clause:
  currently just sleep
- perf improvemnts: lower, in, split, strip & other low hanging  micro optimizations

Handle the following use cases:
- upper/lower case function usages
- spaces between function name and brackets

* test(db_query): Add tests for *_by checks
2022-11-28 12:42:29 +05:30
gavin
35827af172
fix: Strip white spaces on lower cased field value
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2022-11-25 12:39:11 +05:30
Gavin D'souza
1a5e5f546b fix: Move function check inside subquery 2022-11-24 16:27:54 +05:30
Gavin D'souza
575d32ec35 fix(db_query): Space resilient matching 2022-11-24 15:36:28 +05:30
Sagar Vora
f3c00c2bdc
perf: dont fetch meta unless required (#18907) 2022-11-17 13:15:35 +05:30
Ritwik Puri
518b7e1c66
Merge pull request #18251 from Aradhya-Tripathi/bg-submissions
feat: Background submissions for submittable doctypes
2022-11-12 20:06:57 +05:30
Ritwik Puri
ef758130d6
Merge pull request #18852 from resilient-tech/simpler-init
chore(BaseDocument): simplify `_table_fieldnames` property init
2022-11-12 11:09:07 +05:30
Aradhya Tripathi
07bd958dfd
Merge branch 'develop' into bg-submissions 2022-11-12 08:37:55 +05:30
Sagar Vora
7f3ea7a520 chore(BaseDocument): simplify _table_fieldnames property init 2022-11-12 00:36:15 +05:30
gavin
9ad0538521
perf(doc): skip order_by when name is set in load_from_db (#18837)
Setting ORDER BY clause in the SQL nudges MariaDB to not use index
(even) for primary keys.
2022-11-10 16:53:28 +05:30
gavin
a093b7b34c
perf(workflow): get_transitions (#18834)
* Load from db only if doc passed is not of type Document. This was
  added earlier to load in case of dicts. ref: https://github.com/frappe/frappe/pull/11883
* Move blocks to evaluate only if required
* Add typing hints
2022-11-10 16:22:28 +05:30
Ankush Menat
f34f7030a3 refactor: remove txt param from generate_hash use 2022-11-10 11:56:48 +05:30
Sagar Vora
a42ca7d8c1
fix: raise exception if doc before save is not found (#18796)
* fix: raise exception if doc before save is not found

* test: ensure error is raised when trying to save new doc using `doc.save()`

* chore: add comment explaining condition

* test: clearer name and docstring
2022-11-09 19:45:41 +05:30
Ankush Menat
ad7c0816f8
fix: prevent deleting standard doctypes in prod (#18803) 2022-11-08 21:27:41 +05:30
Aradhya
f587140f6f Merge branch 'develop' of https://github.com/Aradhya-Tripathi/frappe into bg-submissions 2022-11-04 18:34:41 +05:30
Ankush Menat
0175fafde3
Merge pull request #18491 from resilient-tech/perf-set-document_naming
perf: cache document naming rule to avoid recurring db calls
2022-11-04 17:13:19 +05:30
Sagar Vora
8b84042037
fix: load doc_before_save in check_if_latest (#18752) 2022-11-04 10:44:17 +05:30
Daizy
78d30905ac refactor: get_doctype_map() using single query and use generator for caching 2022-11-02 09:58:34 +00:00
Daizy
28a124ca47 perf: cache document naming rule to avoid multiple db call 2022-11-02 09:58:34 +00:00
Aradhya
5703303abb Merge branch 'develop' of https://github.com/frappe/frappe into qb-fixes 2022-11-01 13:45:11 +05:30
Sagar Vora
cb7d25a293
fix(meta): ensure that insert_after is always considered when sorting fields (#18682)
* fix(meta): ensure that `insert_after` is always considered when sorting fields

* test: add nosemgrep to comment

Co-authored-by: Dany Roberts <danyrt@wahni.com>
2022-10-31 15:37:55 +05:30
Ankush Menat
8cca50bf26
refactor: remove naming case feature (#18672)
This has never worked since 2016... which can mean two things:
- No one really uses this.
- If I fix this now suddenly people will find different behaviour in
  naming because `name_case` is selected in some doctypes (but never
  tested)
2022-10-31 11:23:49 +05:30
Aradhya Tripathi
f10572cf53
Merge branch 'develop' into qb-fixes 2022-10-29 20:38:52 +05:30
Sagar Vora
6d45b500a1
perf: load _doc_before_save sooner to avoid DB call in check_if_latest (#18666)
* perf: load `_doc_before_save` sooner to avoid DB calls in `check_if_latest`

* fix: specify `for update` in `load_doc_before_save`
2022-10-29 17:55:57 +05:30
Aradhya
e6a281f19e refactor: better naming 2022-10-27 13:11:15 +05:30
Aradhya
7cefc240ac fix: merge conflicts 2022-10-21 14:22:51 +05:30
Aradhya
4a573e252c Merge branch 'develop' of https://github.com/frappe/frappe into qb-fixes 2022-10-20 22:25:44 +05:30
Daizy Modi
fce9ccedaa
fix: only execute generator if value is not found in redis cache (#18472)
* fix: use of generator in

* fix: improve docstring

* fix: improve docstring

* fix: directly assign value to flags

Co-authored-by: Daizy <DaizyModi>
2022-10-20 16:48:03 +05:30
Ankush Menat
20593f155d
fix: delete custom tables when doctype is deleted (#18433)
* fix: delete custom tables when doctype is deleted
2022-10-19 16:45:56 +05:30
Ankush Menat
1bd61d5c25 fix: dont db_set on unsaved document 2022-10-18 17:38:03 +05:30
phot0n
3cae3d057c refactor(minor): made unlock_doc_and_update_status into a simple function
* renamed unlock_doc_and_update_status -> unlock_reference_doc
* added queued_doc property
* renamed check_locked_document -> check_if_locked
* reduced the statuses in submission queue
* refactored unlock_reference_doc a bit
2022-10-13 14:07:11 +05:30
Aradhya
fdf1ed9656 Merge branch 'develop' of https://github.com/frappe/frappe into bg-submissions 2022-10-12 19:34:00 +05:30
Aradhya
01ff3d8bcc fix: fixed locking and checking 2022-10-11 21:20:08 +05:30
Anand Baburajan
feb198a019
docs: fix make_autoname example (#18354) 2022-10-10 21:04:35 +05:30
Aradhya
b733c82a77 feat: Added identifier for locked state of documents
refactor(minor): removed is locked setter to avoid redundancy
2022-10-09 21:26:21 +05:30
Aradhya
0c00c34ad6 fix: temporary document locking 2022-10-09 18:44:28 +05:30
Aradhya
d8ff47aac2 fix: checking and unlocking the correct doc 2022-10-08 04:50:09 +05:30
Aradhya
9074e3e13d feat: Added unlocked button for locked documents not in queue 2022-10-08 01:38:03 +05:30
Ankush Menat
64a0e19329 Revert "fix!: Dont update modified by default in db.set_value (#18301)"
This reverts commit 6aaefd6633.
2022-10-06 22:02:31 +05:30
Ankush Menat
6aaefd6633
fix!: Dont update modified by default in db.set_value (#18301) 2022-10-06 16:01:20 +05:30
Aradhya
b15e07dd79 refactor: better locking and unlocking 2022-10-05 15:58:49 +05:30
Ankush Menat
bd21398252
fix: ignore perm level validation if row deleted (#18290) 2022-10-05 11:16:28 +05:30
Aradhya
198bc39085 refactor: moved submission from document class 2022-10-04 17:20:14 +05:30
Ankush Menat
b8ed8d624c fix: ignore child tables when init-ing parent doc 2022-10-04 14:27:25 +05:30
Aradhya
9cc826541f fix: fixed functionality 2022-10-04 02:41:14 +05:30
Aradhya
eae73ae5d4 feat: log reports for queued submits 2022-10-03 17:36:33 +05:30
Shariq Ansari
fc1e01555b fix: added missing operators 2022-09-30 17:16:40 +05:30
Ritwik Puri
66a31917f7
refactor(minor): reorder and remove unnecessary branches in set_new_name (#18243) 2022-09-29 16:23:55 +05:30