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
* [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
`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
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.
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.
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.
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 changed all cancelled doc patterns to name-CAN-X,
so that amended docs can use the original name instead of name-X.
* 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
* Removed /Form from the function get_url
As per issue #12820, I think /Form was causing a problem so I removed it. Now the get_url returns URL in the format: "app/doctype/name".
* fix: Change to f-strings
* Implement slug on get_url
* Removed slug for names