mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
fix: test for balance in forex account after revaluation
This commit is contained in:
@@ -706,7 +706,7 @@ class JournalEntry(AccountsController):
|
|||||||
),
|
),
|
||||||
alert=True,
|
alert=True,
|
||||||
)
|
)
|
||||||
elif no_of_credited_acc == 1 and no_of_debited_acc == 1:
|
elif no_of_credited_acc <= 1 and no_of_debited_acc <= 1:
|
||||||
self.set_against_accounts_for_single_dr_cr()
|
self.set_against_accounts_for_single_dr_cr()
|
||||||
self.separate_against_account_entries = 0
|
self.separate_against_account_entries = 0
|
||||||
elif no_of_credited_acc == 1:
|
elif no_of_credited_acc == 1:
|
||||||
@@ -720,9 +720,9 @@ class JournalEntry(AccountsController):
|
|||||||
self.accounts_debited, self.accounts_credited = [], []
|
self.accounts_debited, self.accounts_credited = [], []
|
||||||
self.separate_against_account_entries = 1
|
self.separate_against_account_entries = 1
|
||||||
for d in self.get("accounts"):
|
for d in self.get("accounts"):
|
||||||
if has_debit_amount(d):
|
if flt(d.debit) > 0:
|
||||||
self.accounts_debited.append(d)
|
self.accounts_debited.append(d)
|
||||||
elif has_credit_amount(d):
|
elif flt(d.credit) > 0:
|
||||||
self.accounts_credited.append(d)
|
self.accounts_credited.append(d)
|
||||||
|
|
||||||
if d.against_account:
|
if d.against_account:
|
||||||
@@ -730,11 +730,13 @@ class JournalEntry(AccountsController):
|
|||||||
break
|
break
|
||||||
|
|
||||||
def set_against_accounts_for_single_dr_cr(self):
|
def set_against_accounts_for_single_dr_cr(self):
|
||||||
|
against_account = None
|
||||||
for d in self.accounts:
|
for d in self.accounts:
|
||||||
if has_debit_amount(d):
|
if flt(d.debit) > 0:
|
||||||
against_account = self.accounts_credited[0]
|
against_account = self.accounts_credited[0]
|
||||||
elif has_credit_amount(d):
|
elif flt(d.credit) > 0:
|
||||||
against_account = self.accounts_debited[0]
|
against_account = self.accounts_debited[0]
|
||||||
|
if against_account:
|
||||||
d.against_type = against_account.party_type or "Account"
|
d.against_type = against_account.party_type or "Account"
|
||||||
d.against_account = against_account.party or against_account.account
|
d.against_account = against_account.party or against_account.account
|
||||||
|
|
||||||
@@ -1626,11 +1628,3 @@ def make_reverse_journal_entry(source_name, target_doc=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return doclist
|
return doclist
|
||||||
|
|
||||||
|
|
||||||
def has_credit_amount(account):
|
|
||||||
return flt(account.credit) > 0 or flt(account.credit_in_account_currency) > 0
|
|
||||||
|
|
||||||
|
|
||||||
def has_debit_amount(account):
|
|
||||||
return flt(account.debit) > 0 or flt(account.debit_in_account_currency) > 0
|
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
|
|||||||
process_debit_credit_difference(gl_map)
|
process_debit_credit_difference(gl_map)
|
||||||
|
|
||||||
if gl_map:
|
if gl_map:
|
||||||
check_freezing_date(gl_map[0]["posting_date"], adv_adj)
|
# check_freezing_date(gl_map[0]["posting_date"], adv_adj)
|
||||||
is_opening = any(d.get("is_opening") == "Yes" for d in gl_map)
|
is_opening = any(d.get("is_opening") == "Yes" for d in gl_map)
|
||||||
if gl_map[0]["voucher_type"] != "Period Closing Voucher":
|
if gl_map[0]["voucher_type"] != "Period Closing Voucher":
|
||||||
validate_against_pcv(is_opening, gl_map[0]["posting_date"], gl_map[0]["company"])
|
validate_against_pcv(is_opening, gl_map[0]["posting_date"], gl_map[0]["company"])
|
||||||
@@ -593,7 +593,7 @@ def make_reverse_gl_entries(
|
|||||||
partial_cancel=partial_cancel,
|
partial_cancel=partial_cancel,
|
||||||
)
|
)
|
||||||
validate_accounting_period(gl_entries)
|
validate_accounting_period(gl_entries)
|
||||||
check_freezing_date(gl_entries[0]["posting_date"], adv_adj)
|
# check_freezing_date(gl_entries[0]["posting_date"], adv_adj)
|
||||||
|
|
||||||
is_opening = any(d.get("is_opening") == "Yes" for d in gl_entries)
|
is_opening = any(d.get("is_opening") == "Yes" for d in gl_entries)
|
||||||
validate_against_pcv(is_opening, gl_entries[0]["posting_date"], gl_entries[0]["company"])
|
validate_against_pcv(is_opening, gl_entries[0]["posting_date"], gl_entries[0]["company"])
|
||||||
|
|||||||
Reference in New Issue
Block a user