fix: unlink item from healthcare service unit type (#22828)

Co-authored-by: Marica <maricadsouza221197@gmail.com>
This commit is contained in:
Rucha Mahabal 2020-07-30 13:18:41 +05:30 committed by GitHub
parent 00f25842d0
commit 621529adfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,9 @@ class HealthcareServiceUnitType(Document):
def on_trash(self):
if self.item:
try:
frappe.delete_doc('Item', self.item)
item = self.item
self.db_set('item', '')
frappe.delete_doc('Item', item)
except Exception:
frappe.throw(_('Not permitted. Please disable the Service Unit Type'))