fix: Add journal entry in demo
This commit is contained in:
parent
70c5df056d
commit
333f2a565b
@ -78,7 +78,7 @@ demo_master_doctypes = [
|
||||
"customer",
|
||||
"supplier",
|
||||
]
|
||||
demo_transaction_doctypes = ["purchase_invoice", "sales_invoice", "payment_entry"]
|
||||
demo_transaction_doctypes = ["purchase_invoice", "sales_invoice", "payment_entry", "journal_entry"]
|
||||
|
||||
jinja = {
|
||||
"methods": [
|
||||
|
@ -83,7 +83,9 @@ def create_transaction(doctype, company, start_date):
|
||||
posting_date = (
|
||||
start_date if doctype.get("doctype") == "Purchase Invoice" else get_random_date(start_date)
|
||||
)
|
||||
bank_account = frappe.db.get_value("Company", company, "default_bank_account")
|
||||
bank_account, default_receivable_account = frappe.db.get_value(
|
||||
"Company", company, ["default_bank_account", "default_receivable_account"]
|
||||
)
|
||||
bank_field = "paid_to" if doctype.get("party_type") == "Customer" else "paid_from"
|
||||
|
||||
doctype.update(
|
||||
@ -101,20 +103,27 @@ def create_transaction(doctype, company, start_date):
|
||||
"Company", company, ["default_income_account", "default_expense_account"]
|
||||
)
|
||||
|
||||
for item in doctype.get("items") or []:
|
||||
item.update(
|
||||
{
|
||||
"cost_center": erpnext.get_default_cost_center(company),
|
||||
"income_account": income_account,
|
||||
"expense_account": expense_account,
|
||||
}
|
||||
)
|
||||
if doctype in ("Purchase Invoice", "Sales Invoice"):
|
||||
for item in doctype.get("items") or []:
|
||||
item.update(
|
||||
{
|
||||
"cost_center": erpnext.get_default_cost_center(company),
|
||||
"income_account": income_account,
|
||||
"expense_account": expense_account,
|
||||
}
|
||||
)
|
||||
elif doctype == "Journal Entry":
|
||||
pass
|
||||
# update_accounts(doctype, bank_account, default_receivable_account)
|
||||
|
||||
doc = frappe.get_doc(doctype)
|
||||
doc.save(ignore_permissions=True)
|
||||
doc.submit()
|
||||
|
||||
|
||||
# def update_accounts(doctype, company, bank_account):
|
||||
|
||||
|
||||
def get_random_date(start_date):
|
||||
return add_days(start_date, randint(1, 365))
|
||||
|
||||
|
25
erpnext/setup/demo_data/journal_entry.json
Normal file
25
erpnext/setup/demo_data/journal_entry.json
Normal file
@ -0,0 +1,25 @@
|
||||
[
|
||||
{
|
||||
"cheque_date": "2023-03-14",
|
||||
"cheque_no": "33",
|
||||
"doctype": "Journal Entry",
|
||||
"accounts": [
|
||||
{
|
||||
"party_type": "Customer",
|
||||
"party": "ABC Enterprises",
|
||||
"credit_in_account_currency": 40000.0,
|
||||
"debit_in_account_currency": 0.0,
|
||||
"doctype": "Journal Entry Account",
|
||||
"parentfield": "accounts",
|
||||
},
|
||||
{
|
||||
"credit_in_account_currency": 0.0,
|
||||
"debit_in_account_currency": 40000.0,
|
||||
"doctype": "Journal Entry Account",
|
||||
"parentfield": "accounts",
|
||||
}
|
||||
],
|
||||
"user_remark": "test",
|
||||
"voucher_type": "Bank Entry"
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user