[fix] [minor] Negative outstanding validation for JV against JV

This commit is contained in:
Nabin Hait 2013-12-12 12:50:42 +05:30
parent 9d835a039a
commit 13fc64d732

View File

@ -5,8 +5,7 @@ from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, fmt_money, getdate
from webnotes.model.code import get_obj
from webnotes import msgprint, _
from webnotes import _
class DocType:
def __init__(self,d,dl):
@ -130,7 +129,8 @@ def update_outstanding_amt(account, against_voucher_type, against_voucher, on_ca
against_voucher_amount = flt(webnotes.conn.sql("""
select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))
from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s
and account = %s""", (against_voucher, account))[0][0])
and account = %s and ifnull(against_voucher, '') = ''""",
(against_voucher, account))[0][0])
bal = against_voucher_amount + bal
if against_voucher_amount < 0:
bal = -bal