[payment reconciliation] do not allow negative outstanding in case of against_jv
This commit is contained in:
parent
5c13163e84
commit
df28eefa4b
@ -42,9 +42,9 @@ class DocType:
|
|||||||
self.check_negative_balance(adv_adj)
|
self.check_negative_balance(adv_adj)
|
||||||
|
|
||||||
# Update outstanding amt on against voucher
|
# Update outstanding amt on against voucher
|
||||||
if self.doc.against_voucher and self.doc.against_voucher_type not in \
|
if self.doc.against_voucher and self.doc.against_voucher_type != "POS" \
|
||||||
('Journal Voucher','POS') and update_outstanding == 'Yes':
|
and update_outstanding == 'Yes':
|
||||||
self.update_outstanding_amt()
|
self.update_outstanding_amt()
|
||||||
|
|
||||||
def check_mandatory(self):
|
def check_mandatory(self):
|
||||||
mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company']
|
mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company']
|
||||||
@ -164,16 +164,25 @@ class DocType:
|
|||||||
and ifnull(is_cancelled,'No') = 'No'""",
|
and ifnull(is_cancelled,'No') = 'No'""",
|
||||||
(self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
|
(self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
|
||||||
|
|
||||||
if self.doc.against_voucher_type=='Purchase Invoice':
|
if self.doc.against_voucher_type == 'Purchase Invoice':
|
||||||
# amount to debit
|
|
||||||
bal = -bal
|
bal = -bal
|
||||||
|
|
||||||
|
elif self.doc.against_voucher_type == "Journal Voucher":
|
||||||
|
against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit)
|
||||||
|
from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s
|
||||||
|
and account = %s""", (self.doc.against_voucher, self.doc.account))[0][0])
|
||||||
|
|
||||||
|
bal = against_voucher_amount + bal
|
||||||
|
if against_voucher_amount < 0:
|
||||||
|
bal = -bal
|
||||||
|
|
||||||
# Validation : Outstanding can not be negative
|
# Validation : Outstanding can not be negative
|
||||||
if bal < 0 and self.doc.is_cancelled == 'No':
|
if bal < 0 and self.doc.is_cancelled == 'No':
|
||||||
msgprint(_("Outstanding for Voucher ") + self.doc.against_voucher +
|
msgprint(_("Outstanding for Voucher ") + self.doc.against_voucher +
|
||||||
_(" will become ") + fmt_money(bal) + _("Outstanding cannot be less than zero. \
|
_(" will become ") + fmt_money(bal) + _(". Outstanding cannot be less than zero. \
|
||||||
Please match exact outstanding."), raise_exception=1)
|
Please match exact outstanding."), raise_exception=1)
|
||||||
|
|
||||||
# Update outstanding amt on against voucher
|
# Update outstanding amt on against voucher
|
||||||
sql("update `tab%s` set outstanding_amount=%s where name='%s'"%
|
if self.doc.against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
|
||||||
(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))
|
@ -237,6 +237,11 @@ wn.module_page["Accounts"] = [
|
|||||||
route: "query-report/Customer Account Head",
|
route: "query-report/Customer Account Head",
|
||||||
doctype: "Account"
|
doctype: "Account"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label":wn._("Item-wise Sales Register"),
|
||||||
|
route: "query-report/Item-wise Sales Register",
|
||||||
|
doctype: "Sales Invoice"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user