[fix] journal entry against expense claim: pending amount validation
This commit is contained in:
parent
8a2b1bcb97
commit
c9963f1805
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, cint
|
from frappe.utils import cstr, flt, fmt_money, formatdate, getdate
|
||||||
from frappe import msgprint, _, scrub
|
from frappe import msgprint, _, scrub
|
||||||
from erpnext.setup.utils import get_company_currency
|
from erpnext.setup.utils import get_company_currency
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
@ -428,12 +428,11 @@ class JournalEntry(AccountsController):
|
|||||||
def validate_expense_claim(self):
|
def validate_expense_claim(self):
|
||||||
for d in self.accounts:
|
for d in self.accounts:
|
||||||
if d.against_expense_claim:
|
if d.against_expense_claim:
|
||||||
sanctioned_amount, reimbursed_amount = frappe.db.get_value("Expense Claim", d.against_expense_claim,
|
sanctioned_amount, reimbursed_amount = frappe.db.get_value("Expense Claim",
|
||||||
("total_sanctioned_amount", "total_amount_reimbursed"))
|
d.against_expense_claim, ("total_sanctioned_amount", "total_amount_reimbursed"))
|
||||||
pending_amount = cint(sanctioned_amount) - cint(reimbursed_amount)
|
pending_amount = flt(sanctioned_amount) - flt(reimbursed_amount)
|
||||||
if d.debit > pending_amount:
|
if d.debit > pending_amount:
|
||||||
frappe.throw(_("Row No {0}: Amount cannot be greater than Pending Amount against Expense Claim {1}. \
|
frappe.throw(_("Row No {0}: Amount cannot be greater than Pending Amount against Expense Claim {1}. Pending Amount is {2}".format(d.idx, d.against_expense_claim, pending_amount)))
|
||||||
Pending Amount is {2}".format(d.idx, d.against_expense_claim, pending_amount)))
|
|
||||||
|
|
||||||
def validate_credit_debit_note(self):
|
def validate_credit_debit_note(self):
|
||||||
if self.stock_entry:
|
if self.stock_entry:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user