@max_morais_dmm Hi I would really appreciate your help with this. Can I fetch the number of days to add in field from a custom field? Let’s say I would like to enter the credit days manually in each sales, so I did this:
add customer field called “credit_days”
fetch it into the field from customer master like this to retrieve the standard credit days;
Now it would be awesome if you could help change the script to fetch the days to add from the credit days field which is populated automatically from the customer master, but needs to be changed case by case, so when changed it calculates the new due date based on that field.
@max_morais_dmm@nabinhait Hi again, I tried to check that post but I don’t see a way to update the date according to the value in custom field.
What I would like to do is enter for example 40 days in custom field ‘credit_days’ and after that the “payment due date field” should add 40 days to its current date.
@max_morais_dmm I am thankful for your help, maybe I have explained it wrong, let me try again.
I would like to add days based on days that I input in the custom field on the sales invoice document, which I call credit days. I am sorry for the confusion, below is a picture with screenshot for your reference, thank you so much.
@max_morais_dmm I am very thankful for your help, you are awesome!
When I am finished with this customization project, I will share all for the rest to enjoy.
Thank you!
However, we’re both in the same boat. I haven’t found the documentation for frappe datetime methods. I usually just rely on Pycharm’s autocomplete and code suggestion feature. Sometimes, I run console on chrome or firefox just to figure out the different frappe methods.
The frappe.datetime.nowdate() and frappe.datetime.add_days are python/ server side code, so they won’t work in your javascript. Sorry, and I understand your confusion about it.
Frappe uses the moment library for client side datetime functionality. The documentation you need to do this is there. Moment.js | Docs
Yes, you’re trying to do math inside the setter function, which makes it harder to debug. Pull the math out and log it so you can see where you’re going wrong; that’s what I meant by move it into two statements.