mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-13 01:34:10 +00:00
fix: decimal garbage on variable total (#46621)
* fix: decimal dirty on variable total
* fix: linters
* fix: decimal garbage, code improvement
(cherry picked from commit b0dccadd26)
This commit is contained in:
@@ -825,14 +825,13 @@ class JournalEntry(AccountsController):
|
||||
"Debit Note",
|
||||
"Credit Note",
|
||||
]:
|
||||
invoice = frappe.db.get_value(
|
||||
reference_type, reference_name, ["docstatus", "outstanding_amount"], as_dict=1
|
||||
)
|
||||
invoice = frappe.get_doc(reference_type, reference_name)
|
||||
|
||||
if invoice.docstatus != 1:
|
||||
frappe.throw(_("{0} {1} is not submitted").format(reference_type, reference_name))
|
||||
|
||||
if total and flt(invoice.outstanding_amount) < total:
|
||||
precision = invoice.precision("outstanding_amount")
|
||||
if total and flt(invoice.outstanding_amount, precision) < flt(total, precision):
|
||||
frappe.throw(
|
||||
_("Payment against {0} {1} cannot be greater than Outstanding Amount {2}").format(
|
||||
reference_type, reference_name, invoice.outstanding_amount
|
||||
|
||||
Reference in New Issue
Block a user