Demo data for Payment Entry
diff --git a/erpnext/demo/setup_data.py b/erpnext/demo/setup_data.py
index 98892d4..f5c4eb3 100644
--- a/erpnext/demo/setup_data.py
+++ b/erpnext/demo/setup_data.py
@@ -68,7 +68,7 @@
def setup_fiscal_year():
fiscal_year = None
- for year in xrange(2014, now_datetime().year + 1, 1):
+ for year in xrange(2010, now_datetime().year + 1, 1):
try:
fiscal_year = frappe.get_doc({
"doctype": "Fiscal Year",
diff --git a/erpnext/demo/user/accounts.py b/erpnext/demo/user/accounts.py
index 906f30d..e7dceb3 100644
--- a/erpnext/demo/user/accounts.py
+++ b/erpnext/demo/user/accounts.py
@@ -40,33 +40,33 @@
pi.submit()
frappe.db.commit()
- if random.random() <= 0.5:
+ if random.random() < 0.5:
make_payment_entries("Sales Invoice", "Accounts Receivable")
- if random.random() <= 0.5:
+ if random.random() < 0.5:
make_payment_entries("Purchase Invoice", "Accounts Payable")
def make_payment_entries(ref_doctype, report):
outstanding_invoices = list(set([r[3] for r in query_report.run(report,
{"report_date": frappe.flags.current_date })["result"] if r[2]==ref_doctype]))
- # make payment via JV
- for inv in outstanding_invoices[:random.randint(1, 2)]:
- jv = frappe.get_doc(get_payment_entry_against_invoice(ref_doctype, inv))
- jv.posting_date = frappe.flags.current_date
- jv.cheque_no = random_string(6)
- jv.cheque_date = frappe.flags.current_date
- jv.insert()
- jv.submit()
- frappe.db.commit()
- outstanding_invoices.remove(inv)
-
# make Payment Entry
- for inv in outstanding_invoices[:random.randint(1, 3)]:
+ for inv in outstanding_invoices[:random.randint(1, 2)]:
pe = get_payment_entry(ref_doctype, inv)
pe.posting_date = frappe.flags.current_date
pe.reference_no = random_string(6)
pe.reference_date = frappe.flags.current_date
pe.insert()
pe.submit()
- frappe.db.commit()
\ No newline at end of file
+ frappe.db.commit()
+ outstanding_invoices.remove(inv)
+
+ # make payment via JV
+ for inv in outstanding_invoices[:1]:
+ jv = frappe.get_doc(get_payment_entry_against_invoice(ref_doctype, inv))
+ jv.posting_date = frappe.flags.current_date
+ jv.cheque_no = random_string(6)
+ jv.cheque_date = frappe.flags.current_date
+ jv.insert()
+ jv.submit()
+ frappe.db.commit()
\ No newline at end of file