feat: deleting account & stock entries on deletion of transaction (#24298)
* feat: control for deleting account & stock entries on deletion of a transaction * chore: change label & fieldname Co-authored-by: Nabin Hait <nabinhait@gmail.com>
This commit is contained in:
@@ -118,6 +118,12 @@ class AccountsController(TransactionBase):
|
||||
|
||||
def before_cancel(self):
|
||||
validate_einvoice_fields(self)
|
||||
|
||||
def on_trash(self):
|
||||
# delete sl and gl entries on deletion of transaction
|
||||
if frappe.db.get_single_value('Accounts Settings', 'delete_linked_ledger_entries'):
|
||||
frappe.db.sql("delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s", (self.doctype, self.name))
|
||||
frappe.db.sql("delete from `tabStock Ledger Entry` where voucher_type=%s and voucher_no=%s", (self.doctype, self.name))
|
||||
|
||||
def validate_deferred_start_and_end_date(self):
|
||||
for d in self.items:
|
||||
|
||||
Reference in New Issue
Block a user