fix: Reset value_after_depreciation on reversing journal entry during Asset return

This commit is contained in:
Ganga Manoj 2021-12-21 13:59:53 +05:30 committed by GitHub
parent 93068733d6
commit 1ed30ee7c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1049,6 +1049,8 @@ class SalesInvoice(SellingController):
frappe.flags.is_reverse_depr_entry = False
asset.flags.ignore_validate_update_after_submit = True
schedule.journal_entry = None
depreciation_amount = self.get_depreciation_amount_in_je(reverse_journal_entry)
asset.finance_books[0].value_after_depreciation += depreciation_amount
asset.save()
def get_posting_date_of_sales_invoice(self):
@ -1071,6 +1073,12 @@ class SalesInvoice(SellingController):
return False
def get_depreciation_amount_in_je(self, journal_entry):
if journal_entry.accounts[0].debit_in_account_currency:
return journal_entry.accounts[0].debit_in_account_currency
else:
return journal_entry.accounts[0].credit_in_account_currency
@property
def enable_discount_accounting(self):
if not hasattr(self, "_enable_discount_accounting"):