Commit graph

566 commits

Author SHA1 Message Date
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
Suraj Shetty
eb1ed9da9d fix: Option set no_expiry 2022-03-01 19:23:01 +05:30
Suraj Shetty
8cd6b88a20 Merge branch 'develop' of https://github.com/frappe/frappe into fix-document-signature 2022-03-01 14:15:25 +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
Suraj Shetty
105cf91be8 Merge branch 'develop' of https://github.com/frappe/frappe into fix-document-signature 2022-02-28 16:05:52 +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
Suraj Shetty
0ce8f83343 feat: Ability to create share link without expiry 2022-02-18 14:28:00 +05:30
Suraj Shetty
0388398133 Merge branch 'develop' of https://github.com/frappe/frappe into fix-document-signature 2022-02-17 10:49:55 +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
Suraj Shetty
e6c149ee16 fix: Re-use document key if key with same expiry exists 2022-02-07 17:21:16 +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
Suraj Shetty
e0e12d43f1 Merge branch 'develop' of https://github.com/frappe/frappe into fix-document-signature 2022-02-07 13:26:57 +05:30
Suraj Shetty
b7f156f580 fix: Rename "Document Key" to "Document Share Key" 2022-02-07 13:25:39 +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
Suraj Shetty
afeddbb96d fix: Document key expiry logic 2022-01-18 19:27:33 +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
Suraj Shetty
c1b76c49d1 Merge branch 'develop' of https://github.com/frappe/frappe into fix-document-signature 2022-01-13 11:46:42 +05:30
Suraj Shetty
4ee99ce7e1 feat: Set expiry to document link 2022-01-13 11:45:45 +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
Gavin D'souza
62499422a8 style: Make fieldname bold in user message 2021-12-30 10:32:50 +05:30
Suraj Shetty
2d5c5c7f10
fix: Use frappe.permissions.has_permission for proper error message (#15467) 2021-12-28 16:09:42 +05:30
Suraj Shetty
64985a5d1a feat: Document key expiry 2021-12-28 15:19:01 +05:30
Rucha Mahabal
97d049cab9 fix: set fetch from values before checking permissions
Co-authored-by: Suraj Shetty <surajshetty3416@gmail.com>
2021-12-27 12:56:41 +05:30
Suraj Shetty
3c1db7881a fix: Maintain document signature in Document Key table 2021-12-21 15:43:10 +05:30
Ankush Menat
3101c45f26 fix: return self when using save on new docs
for consistency.
2021-12-20 23:08:00 +05:30
Faris Ansari
02759631b4 fix: handle falsy return values in document methods
problem: if a whitelisted document method returns a falsy value like
`[]`, `{}`, `0` then response.message is not set and not returned
in the response.

this change checks if the return value is `None` and falsy values
are returned properly in the response
2021-12-06 15:38:59 +05:30
this-gavagai
8ead1d9c48
fix: Clarified docstatus transition exceptions (#15194)
* [fix] Clarified docstatus transition exceptions

Exceptions issued by the document.py `check_docstatus_transition` method are potentially very misleading. In cases where an invalid docstatus is used, users receive an confusing exception stating "Cannot change docstatus from 0 to 2" or "Cannot change docstatus from 1 to 0". 

This PR adds an additional exception message when an invalid docstatus is used.

* fix: Clarified docstatus transition exceptions

Added additional clarifications to exception messages
2021-12-06 07:28:43 +00:00
Ankush Menat
2a08f35836 fix: allow cancelling by PUT docstatus=2 2021-11-29 18:44:10 +05:30
Ankush Menat
88c3d92662 fix: return self after submit/cancel
`Document.save` returns self but `submit` and `cancel` don't.

change:
For sake of consistency and better support for `run_method` via REST API, return the document.

ref: https://github.com/frappe/frappe/issues/14869
2021-11-27 19:34:47 +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
32c6cf1c44 refactor(misc): frappe.db.delete > frappe.db.sql
Use frappe.db.delete wherever possible. Get rid of all the frappe.db.sql ;)

This commit focuses on the pending modules that had relatively easier
DELETE statements.
2021-08-19 19:53:16 +05:30
Leela vadlamudi
40362c0ac5
Merge pull request #13861 from leela/amended-doc-naming
refactor: set amended docname to original docname
2021-08-09 17:22:55 +05:30
leela
80d111baf2 refactor: set amended docname to original docname
Currently, whenever a document is amended it's name is set
to name-X(X is a counter) when amended again and so on. In this PR,
we have postfixed all cancelled document names with '-CAN' and new
cancelled documents gets a name as original_name-CANC-X.
so that amended docs can use the original name instead of name-X.
2021-08-09 14:59:07 +05:30
Suraj Shetty
a1a18a917e
Merge pull request #13883 from frappe/db-set-no-reload-doc-before-save
fix: do not reset doc_before_save on db_set
2021-08-09 14:34:01 +05:30