fix: Only validate against JV if it's not a reverse depreciation entry

This commit is contained in:
GangaManoj 2021-10-13 20:47:39 +05:30
parent a7ec007dcf
commit 8ea1ad9232
2 changed files with 5 additions and 2 deletions

View File

@ -58,7 +58,10 @@ class JournalEntry(AccountsController):
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 @@ class JournalEntry(AccountsController):
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()

View File

@ -1063,6 +1063,7 @@ class SalesInvoice(SellingController):
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