mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-20 15:25:13 +00:00
fix: compare total debit/credit with precision for Inter Company Journal Entry
(cherry picked from commit 5fe247557e)
This commit is contained in:
@@ -250,11 +250,20 @@ class JournalEntry(AccountsController):
|
|||||||
|
|
||||||
def validate_inter_company_accounts(self):
|
def validate_inter_company_accounts(self):
|
||||||
if self.voucher_type == "Inter Company Journal Entry" and self.inter_company_journal_entry_reference:
|
if self.voucher_type == "Inter Company Journal Entry" and self.inter_company_journal_entry_reference:
|
||||||
doc = frappe.get_doc("Journal Entry", self.inter_company_journal_entry_reference)
|
doc = frappe.db.get_value(
|
||||||
|
"Journal Entry",
|
||||||
|
self.inter_company_journal_entry_reference,
|
||||||
|
["company", "total_debit", "total_credit"],
|
||||||
|
as_dict=True,
|
||||||
|
)
|
||||||
account_currency = frappe.get_cached_value("Company", self.company, "default_currency")
|
account_currency = frappe.get_cached_value("Company", self.company, "default_currency")
|
||||||
previous_account_currency = frappe.get_cached_value("Company", doc.company, "default_currency")
|
previous_account_currency = frappe.get_cached_value("Company", doc.company, "default_currency")
|
||||||
if account_currency == previous_account_currency:
|
if account_currency == previous_account_currency:
|
||||||
if self.total_credit != doc.total_debit or self.total_debit != doc.total_credit:
|
credit_precision = self.precision("total_credit")
|
||||||
|
debit_precision = self.precision("total_debit")
|
||||||
|
if (flt(self.total_credit, credit_precision) != flt(doc.total_debit, debit_precision)) or (
|
||||||
|
flt(self.total_debit, debit_precision) != flt(doc.total_credit, credit_precision)
|
||||||
|
):
|
||||||
frappe.throw(_("Total Credit/ Debit Amount should be same as linked Journal Entry"))
|
frappe.throw(_("Total Credit/ Debit Amount should be same as linked Journal Entry"))
|
||||||
|
|
||||||
def validate_depr_entry_voucher_type(self):
|
def validate_depr_entry_voucher_type(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user