Commit graph

429 commits

Author SHA1 Message Date
Sagar Vora
a33c2e2abe
refactor(BaseDocument)!: improved get, set and extend methods (#16540)
* perf!: 80% faster doc.get for fields with `None` as value

* perf: quicker init child (#3)

* refactor: avoid repitition and improve error message

* test: `doc.extend`

* fix: improve constant naming

* fix: minor improvements and tests

* refactor: improve naming
2022-05-04 18:37:06 +05:30
Gavin D'souza
892e05fdc1 Merge branch 'develop' of github.com:frappe/frappe into bg-rename_doc 2022-04-20 16:04:27 +05:30
Rushabh Mehta
6e6fe9521e fix(linting): no single quotes :'| 2022-04-18 17:29:03 +05:30
Rushabh Mehta
57a55e4225 feat(minor): Add document reference to Error Log and doc.log_error 2022-04-18 17:29:03 +05:30
Ankush Menat
b409a7eeba fix: extend autoname validation to child items 2022-04-14 15:16:59 +05:30
Gavin D'souza
66655eb8ed Merge branch 'develop' of github.com:frappe/frappe into bg-rename_doc 2022-04-14 13:41:56 +05:30
Gavin D'souza
20742e396f Merge branch 'develop' of github.com:frappe/frappe into test-nestedset 2022-04-12 18:09:22 +05:30
Gavin D'souza
01e101d4b8 chore: Add typing and and style conflicts 2022-04-12 15:40:37 +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
Sagar Vora
aedd2fb2b6
Revert "perf: 80% faster doc.get for fields with None as value" (#16490) 2022-04-01 20:39:27 +05:30
gavin
4756efca91
Merge pull request #16477 from resilient-tech/perf-doc-get
perf: 80% faster `doc.get` for fields with `None` as value
2022-04-01 16:26:27 +05:30
gavin
3f6bbd6349
Merge pull request #16474 from resilient-tech/perf-get-doc-filters
perf: reduce query when calling `get_doc` with filters
2022-04-01 15:53:55 +05:30
Sagar Vora
428fc98fa7 chore: add comment to explain line 2022-04-01 14:28:13 +05:30
Sagar Vora
e73c552632 fix: implement for_update for Single documents 2022-04-01 14:15:35 +05:30
Ankush Menat
046f5d31af
fix: don't update autoname field when using Document.save (#16436) 2022-04-01 14:00:27 +05:30
Sagar Vora
811c213082 perf: 80% faster doc.get for fields with None as value 2022-04-01 04:35:19 +05:30
Sagar Vora
0ec26cee70 perf: use as_dict parameter 2022-04-01 01:57:09 +05:30
Sagar Vora
d3f8f676d4 fix: show parent in __repr__ only if available 2022-04-01 01:30:58 +05:30
Sagar Vora
e1cc626bd5 style: improve code readability 2022-04-01 01:18:25 +05:30
Sagar Vora
bd35734307 perf: reduce query when calling get_doc with filters 2022-04-01 00:03:54 +05:30
Sagar Vora
76779e7452 fix: incorrect logic for parenttype parameter in get_all_children 2022-03-31 10:12:44 +05:30
Gavin D'souza
28f9802fd9 fix: rollback to savepoint to avoid partial commits
It's better to keep the validations in and out AND separate...this is a
humble attempt for the same :)
2022-03-28 18:47:26 +05:30
Mohammad Hasnain Mohsin Rajan
fda544f424
refactor!: make automatically following documents optional (#16030)
* fix: make automatically following documents optional

* fix: optimize email triggers for document followed

* test: add tests for document follow settings

* test: sync global search before testing

* fix: extend pypika's cast function to mimic varchar cast in MariaDB

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
Co-authored-by: phot0n <ritwikpuri5678@gmail.com>
2022-03-25 02:01:15 +05:30
Gavin D'souza
d92a64e767 fix: validate before enqueuing rename_doc
* refactor validate_rename
* don't run before_rename hooks twice
* validate_rename kwarg in doc.rename
2022-03-22 14:53:22 +05:30
Gavin D'souza
c6a0469f6a fix: Remove lock record if exists 2022-03-08 17:57:18 +05:30
Gavin D'souza
69fe7eecdf Merge branch 'develop' of github.com:frappe/frappe into bg-rename_doc 2022-03-08 16:55:47 +05:30
Sagar Vora
def10e1e13 chore: remove unused variable doc_before_save 2022-03-07 12:41:45 +05:30
gavin
35c18291ec
Merge branch 'develop' into bg-rename_doc 2022-03-04 01:01:36 +05:30
Gavin D'souza
9e36005c70 fix: Remove taken file locks at end of background job 2022-03-03 20:05:05 +05:30
gavin
873c4ad0ec
Merge pull request #16165 from gavindsouza/creation-doc-man
fix: Set creation dates of standard DocTypes correctly
2022-03-01 12:14:34 +05:30
Sagar Vora
c6049d7e7c
fix: always execute method if found in __dict__ (#15958)
285823
2022-02-28 12:42:08 +00:00
Gavin D'souza
7d04541b68 fix: Don't reset creation dates in install 2022-02-28 17:02:08 +05:30
Sagar Vora
741ea13db2 fix: forget return value after run_method execution 2022-02-28 12:28:02 +05:30
Gavin D'souza
040e01eb59 refactor: doc.enqueue_action & execute_action
* Make args "internal" to avoid name collision. Added __ since these
  args would be utilized by the internal API alone
* perf(EAFP): Try taking a lock and then figure out if there's an error
  instead of the double computation
* Notify document update on completion of Document Action
2022-02-25 01:46:40 +05:30
Gavin D'souza
5a3d8f925e feat: Document.rename API
Transform current document object using the rename_doc API. The design
of the API should allow for easy action queueing.

Defined as `rename(self, name: str, merge: bool = False, force: bool = False)`

Usage:

    In [1]: doc = frappe.get_doc("Person", "5a188f66c1")

    In [2]: doc.rename("5a188f66c2")

    In [3]: doc.name
    Out[3]: '5a188f66c2'
2022-02-25 01:27:21 +05:30
Ankush Menat
c38d1f8a25
Merge pull request #15906 from ankush/ignore_duplicates_db
feat(db/pg): ability to ignore pk collision
2022-02-14 18:58:07 +05:30
Ankush Menat
d3f768fef9 feat(db/pg): ability to ignore pk colission 2022-02-09 16:25:36 +05:30
Rucha Mahabal
78e606bd0f
Merge branch 'develop' into fix-naming-validation 2022-02-09 10:52:24 +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
Mohammad Hasnain Mohsin Rajan
4ff86e1d63
revert: "refactor: set amended docname to original docname" (#15867)
* Revert: "refactor: set amended docname to original docname"

80d111baf2.

* test: test if amended doc has different name
2022-02-04 17:22:18 +05:30
Raffael Meyer
89922bae90
feat: utility methods for docstatus (#15515)
* feat: utility methods for docstatus

* refactor: use utility method for doctsatus

* refactor: enum for docstatus

* refactor: docstatus as property

* fix: set docstatus

* feat: docstatus extends int class

* test: docstatus of BaseDocument

* refactor: occurrences of docstatus

* fix: typo

* refactor: move docstatus to a separate file

* test: docstatus

* fix: sider
2022-02-04 07:41:25 +00:00
Gavin D'souza
d01688bf2d fix: Don't set creation time during doctype sync 2022-01-27 18:33:26 +05:30
Rucha Mahabal
66c8fb9cfa fix: validate doc naming when set via prompt or by passing set_name 2022-01-27 12:24:22 +05:30
barredterra
b1383df15a refactor: use is None instead of == None 2022-01-17 10:37:51 +01:00
Ankush Menat
d09fd25ad7 fix: import permissions
For some reason not importing this is causing issue with running the
functionality directly; specifically when running from background job.
2022-01-14 18:03:41 +05:30
Gavin D'souza
4b9d8c0258 fix: Remove extra Document.validate_owner validation 2022-01-04 15:31:08 +05:30
Gavin D'souza
6f2125fca6 Merge branch 'develop' of github.com:frappe/frappe into owner-unchange 2022-01-04 15:06:37 +05:30
shadrak gurupnor
1832df06ad fix: replace owner with allocated_to 2022-01-04 13:39:33 +05:30
shadrak gurupnor
6c6ff2c16d fix: overriding of owner of doc
feat: Fixed the dilemma of owner field in ToDo document
2022-01-04 13:39:16 +05:30
Gavin D'souza
881f3ad8c1 fix: Set owner & creation if new Document
via a323d624eb
2021-12-30 10:35:49 +05:30