Commit graph

187 commits

Author SHA1 Message Date
Raffael Meyer
6e8820e627
chore: translate doctype in link error (#19164) 2022-12-07 00:31:39 +05:30
Ankush Menat
ad7c0816f8
fix: prevent deleting standard doctypes in prod (#18803) 2022-11-08 21:27:41 +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
Sagar Vora
63e760e3ad chore: remove old code where User Permissions were set in tabDefaultValue 2022-08-22 19:03:30 +05:30
Ankush Menat
d83712d553 feat: delete support for virtual doctypes from desk 2022-07-22 15:42:04 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
mergify[bot]
81d41c8d3a
Merge pull request #17297 from resilient-tech/dont-remove-custom-perms
fix!: dont delete custom permissions when doctype is deleted
2022-06-26 14:22:55 +00:00
Smit Vora
b6963b1dec fix: ignore integration request when deleting doc 2022-06-26 12:53:38 +05:30
Sagar Vora
3c617e3b06 fix!: dont delete custom permissions when doctype is deleted 2022-06-26 11:51:52 +05:30
gruener
1349a73e14
fix: Virtual DocTypes currently breaking Parent-DocType Update and Deletion (#16977)
When you create a Virtual DocType as a Child Table (which is possible without any warning), then it will lead to several errors when updating or deleting of the parent document.

This is because the following files just execute a SQL Statement for the doctype (which doesnt have a DB Table, as this is the nature of a virtual doctype ;-)

**apps/frappe/frappe/model/document.py**
```py
frappe.db.sql("""delete from `tab{0}` where parent=%s and parenttype=%s and parentfield=%s""".format(df.options), (self.name, self.doctype, fieldname))
```

**apps/frappe/frappe/model/delete_doc.py**
```py
frappe.db.sql(
	"delete from `tab%s` where parenttype=%s and parent = %s" % (t, "%s", "%s"), (doctype, name)
)
```

So at these points, I added a check to not perform any sql command for virtual doctypes. With these changes, my affected situation is solved. Perhaps there are other situations, I didn't encounter yet.

As an additional feature, those virtual doctype models should also get an information about the parent is deleted, to propagate the deletion to the remote data pools; but for now I hope this bugfix can be approved.
2022-06-23 11:38:29 +00:00
Suraj Shetty
0cd41fbf0c
Merge branch 'develop' into fix-document-signature-2 2022-06-01 18:01:12 +05:30
Suraj Shetty
59c7fb9e0d fix: Add "Document Share Key" to doctypes_to_skip in delete_doc.py
- To avoid error while deleting linked document.
2022-06-01 17:59:32 +05:30
Ankush Menat
076eb593e3 refactor: delete_from_table
Whole lot of unnecessary complexity, closure, multiple function calls,
comprehensions all that can be replaced with single `get_all`
2022-05-29 13:46:48 +05:30
Ankush Menat
a0ecb912db fix!: dont delete customizations when doctypes are deleted
If someone deletes doctype and restores it back all customization are
lost, there's no "real" reason to delete all these customization. They
are only ever active if the doctype is being used.

Explanations:

- Custom field: is used by meta when doctype meta is requested, if meta
  isn't requested then custom field is effectively inactive.
- Client script: loaded by meta when doctype is requested by desk. So
  inactive in deleted state.
- Property setter: loaded by meta, so inactive when doctype isn't
  present.
- Report: will break doctype isn't present, but user should delete them
  manually to avoid loss of "scripts" or anything special they might
  have done. Also report's doctype don't 100% indicate that it's based
  solely on that doctype.
2022-05-29 13:46:44 +05:30
chillaranand
1d763a6659 refactor: Fix flake8 issues 2022-05-19 15:34:35 +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
phot0n
bebc8058b6 feat: integer primary keys 2022-03-11 23:46:00 +05:30
Ankush Menat
1a34826203 test: use now instead of is_async in tests 2022-02-23 15:37:56 +05:30
Ankush Menat
c5fbd07840
revert: "fix: use now instead of is_async in tests (#15893)" (#15899)
This reverts commit 1cd4722235.
2022-02-07 19:10:42 +05:30
phot0n
266e1f95ed chore: adding back idx column
This is needed for ordering in display of links as it keeps
track of the clicks on a particular link item
2022-02-07 16:40:01 +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
Ankush Menat
1cd4722235
fix: use now instead of is_async in tests (#15893) 2022-02-07 14:00:26 +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
f72c445d41 fix: Clear Document cache on rename, delete 2022-01-03 19:02:41 +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
Suraj Shetty
743e361449
Merge branch 'develop' into core-test-coverage-1 2021-08-23 11:02:50 +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
Suraj Shetty
a7fb1816aa refactor: Remove unused and redundant code 2021-08-19 15:27:25 +05:30
Gavin D'souza
01d275f667 style: Format code for better readability
* Remove trailing whitespaces
* Format code to fit module conventions
* Add appropriate new lines between imports, classes, fn defs, etc
* Added comments, docstrings & module headers
2021-07-28 18:55:27 +05:30
Aradhya-Tripathi
84ff1d0af9 style: removed frappe.db.sql comments 2021-07-28 13:48:01 +05:30
Aradhya-Tripathi
538ef2168b fix: removed wrong queries 2021-07-24 22:58:12 +05:30
Aradhya-Tripathi
1204ae8ce4 fix: fixed spacing and ui tests 2021-07-23 10:45:54 +05:30
Aradhya-Tripathi
8feb430371 refactor: Moved raw queries to frappe orm 2021-07-21 23:32:18 +05:30
Aradhya-Tripathi
eb7e95ae26 refactor: using frappe orm 2021-07-21 19:19:06 +05:30
Gavin D'souza
eca30667d2 chore: Drop FileNotFoundError handling for PY2 2021-05-26 22:21:23 +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
Saqib Ansari
a93c2caab2 fix: reverting of series with a variable 2021-04-06 20:48:33 +05:30
prssanna
e40892fdb6 feat: flag to delete attached files permanently 2021-03-25 14:34:10 +05:30
prssanna
f97cc370cf feat: flag to delete docs permanently 2021-03-25 14:34:10 +05:30
Gavin D'souza
79cb3f0596 feat: Rename "Custom Script" to "Client Script"
* Remove postfix "-Client" from ClientScript.autoname
2021-02-04 14:06:09 +05:30
Rushabh Mehta
c93368b242 fix(minor): merge develop 2021-01-08 14:35:55 +05:30
Gavin D'souza
c876cdc63e fix: Update controllers via delete_doc and rename_doc only in
developer_mode
2020-12-16 19:04:59 +05:30
Rushabh Mehta
ff71329b03 fix(merge): develop 2020-12-02 10:54:10 +05:30
Gavin D'souza
d8335e7a0e Merge branch 'develop' of github.com:frappe/frappe into fix-broken-folders 2020-11-23 11:17:41 +05:30
Gavin D'souza
18c0270168 fix: Delete controllers if delete_doc triggered via tests too 2020-11-11 19:54:31 +05:30
Rushabh Mehta
75fe8a615a feat(app): move /desk to /app 2020-11-11 16:31:47 +05:30
Gavin D'souza
d28fb7ff5e fix: ignore on_trash, delete comment on dt 2020-11-10 18:44:10 +05:30
Rushabh Mehta
b09beb9147 fix(tests): cleanup 2020-08-17 09:41:54 +05:30
Gavin D'souza
009c994d2d fix: set flag in_uninstall to not delete controller code
when bench command is executed to  uninstall-app from site, controller
code should not be deleted
2020-06-19 12:12:15 +05:30
Himanshu
5bb489c637
Update frappe/model/delete_doc.py 2020-04-16 10:06:41 +05:30