Browse Source
fix: Reset value_after_depreciation on reversing journal entry during Asset return
develop
Ganga Manoj
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
0 deletions
-
erpnext/accounts/doctype/sales_invoice/sales_invoice.py
|
|
@ -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"): |
|
|
|