Hi ERP Team,
Can i change posting date on launch of sales invoice screen?
I want to change to : posting_date - 1 (one day before). How can i do.
thanks for help
regards
Jahir
Hi ERP Team,
Can i change posting date on launch of sales invoice screen?
I want to change to : posting_date - 1 (one day before). How can i do.
thanks for help
regards
Jahir
@pajahir , If you want to set Date (posting_date) of Sales Invoice as one day before on form load then you have to calculate before date using custom script and set it to posting_date field.
Try with this code -
frappe.datetime.add_days(new Date(), -1)
hi thanks, it does not work. I am using version 4.0
If any error shows on console , please provide screen-shot. OR provide your script code.
@pajahir not sure whether the same logic applies for a 4.0 ERPNext but I’d say you need to
This should result into a slightly different Invoice number (adding a xxx-1 at the end) for the amended Version. The “cancelled” invoice still exist but is in “cancelled” state and therefore has no affect on your accounting entries any longer. In case there is already a payment against a submitted invoice I wouldn’t be sure whether the described procedure is still possible.
hi, screen shot attached for customized script page.
There is no error while launching sales invoice after this code. But still it displays current date.
thank you.
@pajahir
Try this one -
frappe.ui.form.on("Sales Invoice", {
onload: function(frm) {
frm.set_value("posting_date", frappe.datetime.add_days(frm.posting_date, -1));
}
})
@pajahir , You have to write code to set this value to posting_date field. There is no meaning of your script.
Try with following code -
frappe.ui.form.on("Sales Invoice", "onload", function(frm,doc) {
var date = frappe.datetime.add_days(new Date(), -1)
frm.doc.posting_date = date;
});
it works good. thanks to both of u .