From 1606626d29e99402414f4b369bbff864fda250e5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 21 Jul 2016 11:00:28 +0530 Subject: [PATCH] Demo data for Payment Entry --- erpnext/demo/setup_data.py | 2 +- erpnext/demo/user/accounts.py | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/erpnext/demo/setup_data.py b/erpnext/demo/setup_data.py index 98892d4b81..f5c4eb3a13 100644 --- a/erpnext/demo/setup_data.py +++ b/erpnext/demo/setup_data.py @@ -68,7 +68,7 @@ def setup_demo_page(): 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 906f30d3df..e7dceb3887 100644 --- a/erpnext/demo/user/accounts.py +++ b/erpnext/demo/user/accounts.py @@ -40,33 +40,33 @@ def work(): 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