Merge pull request #2394 from nabinhait/5_develop

Credit days validation fixes
This commit is contained in:
Nabin Hait 2014-11-10 11:44:24 +05:30
commit c3e87b0c02

View File

@ -81,7 +81,7 @@ class JournalVoucher(AccountsController):
def check_credit_days(self):
from erpnext.accounts.party import get_credit_days
posting_date = self.posting_date
posting_date = None
if self.cheque_date:
for d in self.get("entries"):
if d.party_type and d.party and d.get("credit" if d.party_type=="Customer" else "debit") > 0:
@ -91,11 +91,11 @@ class JournalVoucher(AccountsController):
posting_date = frappe.db.get_value("Purchase Invoice", d.against_voucher, "posting_date")
credit_days = get_credit_days(d.party_type, d.party, self.company)
if credit_days:
if posting_date and credit_days:
date_diff = (getdate(self.cheque_date) - getdate(posting_date)).days
if date_diff > flt(credit_days):
msgprint(_("Note: Reference Date exceeds allowed credit days by {0} days for {1} {2}")
.format(date_diff, d.party_type, d.party))
.format(date_diff - flt(credit_days), d.party_type, d.party))
def validate_cheque_info(self):
if self.voucher_type in ['Bank Voucher']: