Demo data for Payment Entry
This commit is contained in:
parent
26cad30372
commit
1606626d29
@ -68,7 +68,7 @@ def setup_demo_page():
|
|||||||
|
|
||||||
def setup_fiscal_year():
|
def setup_fiscal_year():
|
||||||
fiscal_year = None
|
fiscal_year = None
|
||||||
for year in xrange(2014, now_datetime().year + 1, 1):
|
for year in xrange(2010, now_datetime().year + 1, 1):
|
||||||
try:
|
try:
|
||||||
fiscal_year = frappe.get_doc({
|
fiscal_year = frappe.get_doc({
|
||||||
"doctype": "Fiscal Year",
|
"doctype": "Fiscal Year",
|
||||||
|
@ -40,33 +40,33 @@ def work():
|
|||||||
pi.submit()
|
pi.submit()
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
if random.random() <= 0.5:
|
if random.random() < 0.5:
|
||||||
make_payment_entries("Sales Invoice", "Accounts Receivable")
|
make_payment_entries("Sales Invoice", "Accounts Receivable")
|
||||||
|
|
||||||
if random.random() <= 0.5:
|
if random.random() < 0.5:
|
||||||
make_payment_entries("Purchase Invoice", "Accounts Payable")
|
make_payment_entries("Purchase Invoice", "Accounts Payable")
|
||||||
|
|
||||||
def make_payment_entries(ref_doctype, report):
|
def make_payment_entries(ref_doctype, report):
|
||||||
outstanding_invoices = list(set([r[3] for r in query_report.run(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]))
|
{"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
|
# 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 = get_payment_entry(ref_doctype, inv)
|
||||||
pe.posting_date = frappe.flags.current_date
|
pe.posting_date = frappe.flags.current_date
|
||||||
pe.reference_no = random_string(6)
|
pe.reference_no = random_string(6)
|
||||||
pe.reference_date = frappe.flags.current_date
|
pe.reference_date = frappe.flags.current_date
|
||||||
pe.insert()
|
pe.insert()
|
||||||
pe.submit()
|
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()
|
Loading…
x
Reference in New Issue
Block a user