Commit graph

375 commits

Author SHA1 Message Date
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
Saif
7400d7ca37
fix: do not reset doc_before_save on db_set 2021-08-07 13:09:28 +05:00
Ankush Menat
1ffb0b1d7c
fix: validate code fields of children too 2021-08-06 12:52:12 +05:30
Ankush
257723cb0a
feat: PythonExpression and Python option with syntax validation for Code field types (#13707)
* feat: `PythonExpression` and `Python` options for `Code` fields

* fix: check python expressions in assignment rule

* fix: replace server script syntax validation

* fix: validate condition in workflow transition

Add PythonExpression in Options.
2021-08-06 04:10:09 +00:00
Leela vadlamudi
32a266927f
Merge pull request #13800 from leela/revert-amend-doc-feat
Revert "refactor: set amended docname to original docname"
2021-07-30 06:45:59 +05:30
leela
b719e1481d Revert "refactor: set amended docname to original docname"
This reverts commit d459847ae3.
2021-07-28 17:00:12 +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
2f3371d873 refactor: Moved raw queries to frappe orm 2021-07-23 23:14:24 +05:30
leela
d459847ae3 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 changed all cancelled doc patterns to name-CAN-X,
so that amended docs can use the original name instead of name-X.
2021-07-21 10:51:32 +05:30
leela
f31d01a2a6 Revert "Merge pull request #13244 from prssanna/amended-doc-naming"
This reverts commit 58b95662c2, reversing
changes made to c553b7e23a.
2021-07-02 17:43:16 +05:30
leela
3552132789 fix: remove not needed six import 2021-07-02 11:25:20 +05:30
Leela vadlamudi
4800ee8725
Merge branch 'develop' into amended-doc-naming 2021-07-02 10:47:47 +05:30
Gavin D'souza
674c8cf77b chore: Use get_absolute_url to doc.get_url
Avoid re-implementation to reduce interfaces for possible bugs/fixes
2021-06-07 12:09:22 +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
Akshay Kumar Tripathi
b0f1bbc378
fix: corrected the function get_url (#13330)
* 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
2021-05-26 05:07:50 +00:00
prssanna
1c4e1bc1df refactor: set amended docname to original docname 2021-05-17 17:12:28 +05:30
Ankush Menat
adbf267212
feat(DX): Add __repr__ and __str__ for DocTypes
- Show doctype and name
- if docstatus != 0, show docstatus
- if child doctype, show parent
2021-05-05 19:45:33 +05:30
Shridhar Patil
361cd935d6
Merge branch 'develop' into virtual_doctype 2021-04-01 09:46:35 +05:30
Sagar Vora
aed90126f3 fix: incorrect condition 2021-03-30 13:32:36 +05:30
Sagar Vora
497ea861f4 feat: frappe.whitelist for class methods 2021-03-30 13:07:58 +05:30
prssanna
45e7943928 style: remove commented out line 2021-03-24 12:41:33 +05:30
Suraj Shetty
91c9dce6c0 fix: Create copy of meta fields for checks 2021-03-24 10:58:56 +05:30
Suraj Shetty
514d7480e6 fix: Do not validate permlevel for admin 2021-03-24 09:43:36 +05:30
Suraj Shetty
7e5f86789c fix: Do not check permlevel > 0
- while creating has_access_to list
2021-03-23 19:53:05 +05:30
Chinmay Pai
043a6c0804
Merge branch 'develop' into virtual_doctype 2021-03-17 20:18:44 +05:30
prssanna
32c1847a1d fix: remove redundant application of field level permissions 2021-03-17 14:08:37 +05:30
prssanna
e5a27c22b0 Merge branch 'develop' of https://github.com/frappe/frappe into permlevel-fix 2021-02-25 14:46:00 +05:30
Aditya Hase
b0456503f2
perf: Remove frappe.utils.background_job from import tree 2021-02-21 09:42:04 +05:30
Rohit Waghchaure
bfab46c536 fix: ignore notify update in patch execution 2021-02-18 13:33:12 +05:30
Shridhar Patil
0e0e857e1d
Merge branch 'develop' into virtual_doctype 2021-02-02 14:02:32 +05:30
Suraj Shetty
b94d5778a8 Merge branch 'develop' of https://github.com/frappe/frappe into rebrand-ui 2021-01-19 10:36:50 +05:30
prssanna
455a861a0d fix: do not assume that higher perm level will be set for a doctype 2021-01-15 14:39:16 +05:30
Shridhar
d48e470b86
fix: renamed label and field name 2021-01-11 13:13:39 +05:30
Shridhar
42d889d2a4
fix: handle virtual doctype flag for existing doctypes 2021-01-11 13:13:38 +05:30
Shridhar
c7b29100af
feat: virtual doctype
Virtual Doctype's data souurce can be anything a file or a secondary database table or an api
2021-01-11 13:13:37 +05:30
Deepesh Garg
dd46199dd7 feat: Allow ignoring validations via server script 2021-01-03 20:04:45 +05:30
Rushabh Mehta
75fe8a615a feat(app): move /desk to /app 2020-11-11 16:31:47 +05:30
Deepesh Garg
dbd8f52e54 feat: Non negative check for Int, Float and Currency fields 2020-10-29 16:40:38 +05:30
Rushabh Mehta
426a946408
fix(minor): file name cannot contain separator (#11426) 2020-09-07 16:58:20 +05:30
Rushabh Mehta
b4b620e738 fix(refactor): event_update_log - move code from document.py and cleanup hooks 2020-08-17 09:41:54 +05:30
Rushabh Mehta
3d6b3870bd fix(minor): document.py:notify_consumers 2020-08-17 09:41:54 +05:30