Demo data for Payment Entry

This commit is contained in:
Nabin Hait 2016-07-21 11:00:28 +05:30
parent 26cad30372
commit 1606626d29
2 changed files with 16 additions and 16 deletions

View File

@ -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",

View File

@ -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()
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()