fix: Only validate against JV if it's not a reverse depreciation entry
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index e568a82..d04e4a5 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -58,7 +58,10 @@
if not frappe.flags.in_import:
self.validate_total_debit_and_credit()
- self.validate_against_jv()
+ if not self.flags.is_reverse_depr_entry:
+ self.validate_against_jv()
+ self.validate_stock_accounts()
+
self.validate_reference_doc()
if self.docstatus == 0:
self.set_against_account()
@@ -69,7 +72,6 @@
self.validate_empty_accounts_table()
self.set_account_and_party_balance()
self.validate_inter_company_accounts()
- self.validate_stock_accounts()
if self.docstatus == 0:
self.apply_tax_withholding()
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 44a5fae..2744e0d 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -1063,6 +1063,7 @@
reverse_journal_entry = make_reverse_journal_entry(schedule.journal_entry)
reverse_journal_entry.posting_date = nowdate()
+ reverse_journal_entry.flags.is_reverse_depr_entry = True
reverse_journal_entry.submit()
asset.flags.ignore_validate_update_after_submit = True