mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 23:19:20 +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",
|
"Debit Note",
|
||||||
"Credit Note",
|
"Credit Note",
|
||||||
]:
|
]:
|
||||||
invoice = frappe.db.get_value(
|
invoice = frappe.get_doc(reference_type, reference_name)
|
||||||
reference_type, reference_name, ["docstatus", "outstanding_amount"], as_dict=1
|
|
||||||
)
|
|
||||||
|
|
||||||
if invoice.docstatus != 1:
|
if invoice.docstatus != 1:
|
||||||
frappe.throw(_("{0} {1} is not submitted").format(reference_type, reference_name))
|
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(
|
frappe.throw(
|
||||||
_("Payment against {0} {1} cannot be greater than Outstanding Amount {2}").format(
|
_("Payment against {0} {1} cannot be greater than Outstanding Amount {2}").format(
|
||||||
reference_type, reference_name, invoice.outstanding_amount
|
reference_type, reference_name, invoice.outstanding_amount
|
||||||
|
|||||||
Reference in New Issue
Block a user