mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Dont add opening entries in account balance debit, credit column
This commit is contained in:
@@ -35,7 +35,7 @@ class DocType:
|
|||||||
if not (flt(self.doc.debit) or flt(self.doc.credit)):
|
if not (flt(self.doc.debit) or flt(self.doc.credit)):
|
||||||
msgprint("GL Entry: Debit or Credit amount is mandatory for %s" % self.doc.account)
|
msgprint("GL Entry: Debit or Credit amount is mandatory for %s" % self.doc.account)
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
# Debit and credit can not done at the same time
|
# Debit and credit can not done at the same time
|
||||||
if flt(self.doc.credit) != 0 and flt(self.doc.debit) != 0:
|
if flt(self.doc.credit) != 0 and flt(self.doc.debit) != 0:
|
||||||
msgprint("Sorry you cannot credit and debit under same account head.")
|
msgprint("Sorry you cannot credit and debit under same account head.")
|
||||||
@@ -146,8 +146,8 @@ class DocType:
|
|||||||
|
|
||||||
# build dict
|
# build dict
|
||||||
p = {
|
p = {
|
||||||
'debit': flt(debit)
|
'debit': self.doc.is_opening=='No' and flt(debit) or 0
|
||||||
,'credit':flt(credit)
|
,'credit':self.doc.is_opening=='No' and flt(credit) or 0
|
||||||
,'opening': self.doc.is_opening=='Yes' and amt or 0
|
,'opening': self.doc.is_opening=='Yes' and amt or 0
|
||||||
# end date condition only if it is not opening
|
# end date condition only if it is not opening
|
||||||
,'end_date_condition':(self.doc.is_opening!='Yes' and ("and ab.end_date >= '"+self.doc.posting_date+"'") or '')
|
,'end_date_condition':(self.doc.is_opening!='Yes' and ("and ab.end_date >= '"+self.doc.posting_date+"'") or '')
|
||||||
@@ -185,6 +185,7 @@ class DocType:
|
|||||||
|
|
||||||
bal = flt(sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled,'No') = 'No'", (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
|
bal = flt(sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s and ifnull(is_cancelled,'No') = 'No'", (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
|
||||||
tds = 0
|
tds = 0
|
||||||
|
|
||||||
if self.doc.against_voucher_type=='Payable Voucher':
|
if self.doc.against_voucher_type=='Payable Voucher':
|
||||||
# amount to debit
|
# amount to debit
|
||||||
bal = -bal
|
bal = -bal
|
||||||
@@ -199,7 +200,7 @@ class DocType:
|
|||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
# Update outstanding amt on against voucher
|
# Update outstanding amt on against voucher
|
||||||
sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (self.doc.against_voucher_type, bal, self.doc.against_voucher))
|
sql("update `tab%s` set outstanding_amount=%s where name='%s'"% (self.doc.against_voucher_type,bal,self.doc.against_voucher))
|
||||||
|
|
||||||
|
|
||||||
# Total outstanding can not be greater than credit limit for any time for any customer
|
# Total outstanding can not be greater than credit limit for any time for any customer
|
||||||
|
|||||||
Reference in New Issue
Block a user