Change date base on fixed number

i have this situation on invoice, if i want to select 15 days i have to count, or 25 days i have to lose some time searching,
its possible to insert a field that i can put the number of days i want and it change the payment due date to the number of days a want in advance?
i hope you understand

Try to add to Customer “Credit Days Based On” - “Fixed Days” and add Credit Days(15)

yes thats work thank you
but in case that is not a credit client
there is any scrip to put this days directly on the invoice

I am not sure that it exists directly in sales invoice but I think you can create your custom script to add it in invoice

yes i am trying to check on that but not good on scripts!4
but thank you for the support

as I saw you add “Credit Days” field, right? please try something like this
frappe.ui.form.on('Sales Invoice',{ refresh: function(frm) { var del_date = new Date(frm.doc.posting_date) frm.doc.due_date = new Date(del_date).setDate(del_date.getDate()+ frm.doc.credit_days) } }

i have tried but i am having this issue

I missed
frappe.ui.form.on('Sales Invoice',{ refresh: function(frm) { var del_date = new Date(frm.doc.posting_date) frm.doc.due_date = new Date(del_date).setDate(del_date.getDate()+ frm.doc.credit_days) } }) “)” at the end please add and it is possible for you to show console next time? and sorry I cannot test it by myself before sharing with you

still
there is the console i think

Hi I don’t know how you make so nice gifs;-) I can only make screenshots and as you can see I use Chrome and everything works


also don’t forget to refresh Sales Invoice page after making changes in Custom Script.

i use this program called licecap is free

thanks) do you have any success?

i am trying again will give a feedback soon

thanks it works,
but its interfering with some customers that have credit application, define by default on customer,