seitime-frappe/frappe/core
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
..
api fix(linting): Sort imports 2022-04-18 18:17:40 +05:30
doctype fix: Virtual DocTypes currently breaking Parent-DocType Update and Deletion (#16977) 2022-06-23 11:38:29 +00:00
form_tour/doctype fix: module load issue, tour description and save field overlay 2021-11-25 17:57:07 +05:30
page Merge pull request #17223 from frappe/rpm_typo 2022-06-16 16:20:27 +05:30
report refactor: Remove unused imports & code 2022-05-19 15:34:35 +05:30
web_form refactor: Remove unused imports & code 2022-05-19 15:34:35 +05:30
workspace fix: updated standard workspace json files 2022-01-13 18:40:36 +05:30
__init__.py chore: Update header: license.txt => LICENSE 2021-09-03 12:02:59 +05:30
notifications.py refactor: Remove unused imports & code 2022-05-19 15:34:35 +05:30
README.md rename Profile to User frappe/frappe#470 2014-03-11 16:14:47 +05:30
utils.py style: format all python files using black (#16453) 2022-04-12 10:59:25 +05:30

Core module contains the models required for the basic functioning of frappe including DocType, User (user), Role and others.