fix: Add journal entry in demo
This commit is contained in:
parent
70c5df056d
commit
333f2a565b
@ -78,7 +78,7 @@ demo_master_doctypes = [
|
|||||||
"customer",
|
"customer",
|
||||||
"supplier",
|
"supplier",
|
||||||
]
|
]
|
||||||
demo_transaction_doctypes = ["purchase_invoice", "sales_invoice", "payment_entry"]
|
demo_transaction_doctypes = ["purchase_invoice", "sales_invoice", "payment_entry", "journal_entry"]
|
||||||
|
|
||||||
jinja = {
|
jinja = {
|
||||||
"methods": [
|
"methods": [
|
||||||
|
@ -83,7 +83,9 @@ def create_transaction(doctype, company, start_date):
|
|||||||
posting_date = (
|
posting_date = (
|
||||||
start_date if doctype.get("doctype") == "Purchase Invoice" else get_random_date(start_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"
|
bank_field = "paid_to" if doctype.get("party_type") == "Customer" else "paid_from"
|
||||||
|
|
||||||
doctype.update(
|
doctype.update(
|
||||||
@ -101,6 +103,7 @@ def create_transaction(doctype, company, start_date):
|
|||||||
"Company", company, ["default_income_account", "default_expense_account"]
|
"Company", company, ["default_income_account", "default_expense_account"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if doctype in ("Purchase Invoice", "Sales Invoice"):
|
||||||
for item in doctype.get("items") or []:
|
for item in doctype.get("items") or []:
|
||||||
item.update(
|
item.update(
|
||||||
{
|
{
|
||||||
@ -109,12 +112,18 @@ def create_transaction(doctype, company, start_date):
|
|||||||
"expense_account": expense_account,
|
"expense_account": expense_account,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
elif doctype == "Journal Entry":
|
||||||
|
pass
|
||||||
|
# update_accounts(doctype, bank_account, default_receivable_account)
|
||||||
|
|
||||||
doc = frappe.get_doc(doctype)
|
doc = frappe.get_doc(doctype)
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
doc.submit()
|
doc.submit()
|
||||||
|
|
||||||
|
|
||||||
|
# def update_accounts(doctype, company, bank_account):
|
||||||
|
|
||||||
|
|
||||||
def get_random_date(start_date):
|
def get_random_date(start_date):
|
||||||
return add_days(start_date, randint(1, 365))
|
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