fix: Posting Date bug in load_defaults (#23415)
this.frm.posting_date is always invalid and should be changed to this.frm.doc.posting_date The effect of this bug fix is, a default Posting Date value may now be set in Custom Script's onload event, and the default value will be honored. Example: (Assuming posting date has been included in standard filter) ``` frappe.ui.form.on('Journal Entry', { 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 ) } }) ``` Without the fix, the posting date will always be today's date. With the bug fix, the default value for posting date which is taken from the posting date's Standard Filter vale is honored. Co-authored-by: Sagar Vora <sagar@resilient.tech>
This commit is contained in:
parent
174019a838
commit
8115be58a3
@ -210,7 +210,7 @@ erpnext.accounts.JournalEntry = frappe.ui.form.Controller.extend({
|
||||
$.each(this.frm.doc.accounts || [], function(i, jvd) {
|
||||
frappe.model.set_default_values(jvd);
|
||||
});
|
||||
var posting_date = this.frm.posting_date;
|
||||
var posting_date = this.frm.doc.posting_date;
|
||||
if(!this.frm.doc.amended_from) this.frm.set_value('posting_date', posting_date || frappe.datetime.get_today());
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user