[fix] Update outstanding amount function fixed if party not mentioned
This commit is contained in:
parent
c3b492b237
commit
818d9674d9
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from frappe.utils import flt, fmt_money, getdate, formatdate
|
from frappe.utils import flt, fmt_money, getdate, formatdate, cstr
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
@ -118,7 +118,7 @@ def update_outstanding_amt(account, party_type, party, against_voucher_type, aga
|
|||||||
bal = flt(frappe.db.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
bal = flt(frappe.db.sql("""select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where against_voucher_type=%s and against_voucher=%s
|
where against_voucher_type=%s and against_voucher=%s
|
||||||
and account = %s and party_type=%s and party=%s""",
|
and account = %s and ifnull(party_type, '')=%s and ifnull(party, '')=%s""",
|
||||||
(against_voucher_type, against_voucher, account, party_type, party))[0][0] or 0.0)
|
(against_voucher_type, against_voucher, account, party_type, party))[0][0] or 0.0)
|
||||||
|
|
||||||
if against_voucher_type == 'Purchase Invoice':
|
if against_voucher_type == 'Purchase Invoice':
|
||||||
@ -127,8 +127,9 @@ def update_outstanding_amt(account, party_type, party, against_voucher_type, aga
|
|||||||
against_voucher_amount = flt(frappe.db.sql("""
|
against_voucher_amount = flt(frappe.db.sql("""
|
||||||
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
|
||||||
from `tabGL Entry` where voucher_type = 'Journal Entry' and voucher_no = %s
|
from `tabGL Entry` where voucher_type = 'Journal Entry' and voucher_no = %s
|
||||||
and account = %s and party_type=%s and party=%s and ifnull(against_voucher, '') = ''""",
|
and account = %s and ifnull(party_type, '')=%s and ifnull(party, '')=%s
|
||||||
(against_voucher, account, party_type, party))[0][0])
|
and ifnull(against_voucher, '') = ''""",
|
||||||
|
(against_voucher, account, cstr(party_type), cstr(party)))[0][0])
|
||||||
|
|
||||||
if not against_voucher_amount:
|
if not against_voucher_amount:
|
||||||
frappe.throw(_("Against Journal Entry {0} is already adjusted against some other voucher")
|
frappe.throw(_("Against Journal Entry {0} is already adjusted against some other voucher")
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import flt, cstr
|
from frappe.utils import flt, cstr, cint
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.meta import get_field_precision
|
from frappe.model.meta import get_field_precision
|
||||||
from erpnext.accounts.utils import validate_expense_against_budget
|
from erpnext.accounts.utils import validate_expense_against_budget
|
||||||
|
Loading…
x
Reference in New Issue
Block a user