Default Posting Date for Journal Entry

Hi! Is there a way to set a default posting date for Journal Entry instead of today’s date?

The use case is, Journal Entry is usually entered as in batches with dates that may be dated yesterday.

Got it! I was able to set the default posting date. But it took a bug fix

Step 1. Fix bug
apps/erpnext/erpnext/accounts/doctype/journal_entry/journal_entry.js (version-13-beta)
line 213: change

			var posting_date = this.frm.posting_date;

to

			var posting_date = this.frm.doc.posting_date;

Step 2. Create Custom Script for Doctype Journal Entry

frappe.ui.form.on('Journal Entry', {
	refresh(frm) {
		// your code here
	},
	before_load(frm) {
	    var posting_date = $("input[data-fieldname='posting_date']")[0].value
	    posting_date = moment(posting_date)._d
	    frm.set_value('posting_date', posting_date )
	}
})

Notes:

  1. $(“input[data-fieldname=‘posting_date’]”)[0].value will return the standard filter value.
  2. frappe.datetime is a bit tricky. So, we go straight to moment

Step 3.
Edit Doctype Journal Entry (Customization)

  1. Posting Date - check In Standard Filter

During Entry:

In list view, place the desired default posting date in the standard filter for posting date.