I need help to write a small custom script which would check the Sales Order Date with the current date at the time of SAVING or SUBMITTING a SO and would not allow the user to save or submit it on a date which earlier than TODAY.
So SO_Date >= Today() is the condition I want to be checked at the time of saving or submitting a SO.
–
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
// if there is existing content in custom_validate paste only this part within the curly braces of custom_validate
if (wn.datetime.str_to_obj(doc.transaction_date < new Date()) {
validated = false;
webnotes.msgprint("Sales Order Date cannot be a past date");
} );
// paste till here
}
This should do the trick.
Thanks,
Anand.
On 11-Aug-2012, at 8:09 PM, Aditya Duggal <ad...@gmail.com> wrote:
I need help to write a small custom script which would check the Sales Order Date with the current date at the time of SAVING or SUBMITTING a SO and would not allow the user to save or submit it on a date which earlier than TODAY.
So SO_Date >= Today() is the condition I want to be checked at the time of saving or submitting a SO.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
// if there is existing content in custom_validate paste only this part within the curly braces of custom_validate
if (wn.datetime.str_to_obj(doc.transaction_date) < new Date()) {
validated = false;
msgprint("Sales Order Date cannot be a past date"); // or any other message you want..
}
// paste till here
}
Thanks,
Anand.
On 11-Aug-2012, at 8:09 PM, Aditya Duggal <ad...@gmail.com> wrote:
I need help to write a small custom script which would check the Sales Order Date with the current date at the time of SAVING or SUBMITTING a SO and would not allow the user to save or submit it on a date which earlier than TODAY.
So SO_Date >= Today() is the condition I want to be checked at the time of saving or submitting a SO.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
// if there is existing content in custom_validate paste only this part within the curly braces of custom_validate
if (wn.datetime.str_to_obj(doc.transaction_date) < new Date()) {
validated = false;
msgprint(“Sales Order Date cannot be a past date”); // or any other message you want…
}
// paste till here
}
Thanks,
Anand.
On 11-Aug-2012, at 8:09 PM, Aditya Duggal <ad…@gmail.com> wrote:
I need help to write a small custom script which would check the Sales Order Date with the current date at the time of SAVING or SUBMITTING a SO and would not allow the user to save or submit it on a date which earlier than TODAY.
So SO_Date >= Today() is the condition I want to be checked at the time of saving or submitting a SO.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
This works fine but only one problem that the Validation fails when the date is equal to the system date as well and in the code I cannot see anything which should reject the validation on the basis of the sales order date being equal to the Today’s Date.
On Monday, August 13, 2012 11:24:39 AM UTC+5:30, Anand Doshi wrote:
Hi Aditya,
There is a syntax error in the reply I sent… please find the corrected script below:
// if there is existing content in custom_validate paste only this part within the curly braces of custom_validate
if (wn.datetime.str_to_obj(doc.transaction_date) < new Date()) {
validated = false;
msgprint(“Sales Order Date cannot be a past date”); // or any other message you want…
}
// paste till here
}
Thanks,
Anand.
On 11-Aug-2012, at 8:09 PM, Aditya Duggal <ad…@gmail.com> wrote:
I need help to write a small custom script which would check the Sales Order Date with the current date at the time of SAVING or SUBMITTING a SO and would not allow the user to save or submit it on a date which earlier than TODAY.
So SO_Date >= Today() is the condition I want to be checked at the time of saving or submitting a SO.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
// if there is existing content in custom_validate paste only this part within the curly braces of custom_validate
if (wn.datetime.get_day_diff(new Date(), wn.datetime.str_to_obj(doc.transaction_date)) > 0) {
validated = false;
msgprint("Sales Order Date cannot be a past date"); // or any other message you want..
}
// paste till here
}
thanks,
Anand.
On 13-Aug-2012, at 1:02 PM, Aditya Duggal <ad...@gmail.com> wrote:
Hi Anand,
This works fine but only one problem that the Validation fails when the date is equal to the system date as well and in the code I cannot see anything which should reject the validation on the basis of the sales order date being equal to the Today's Date.
On Monday, August 13, 2012 11:24:39 AM UTC+5:30, Anand Doshi wrote:
Hi Aditya,
There is a syntax error in the reply I sent.. please find the corrected script below:
// if there is existing content in custom_validate paste only this part within the curly braces of custom_validate
if (wn.datetime.str_to_obj(doc.transaction_date) < new Date()) {
validated = false;
msgprint("Sales Order Date cannot be a past date"); // or any other message you want..
}
// paste till here
}
Thanks,
Anand.
On 11-Aug-2012, at 8:09 PM, Aditya Duggal <ad...@gmail.com> wrote:
I need help to write a small custom script which would check the Sales Order Date with the current date at the time of SAVING or SUBMITTING a SO and would not allow the user to save or submit it on a date which earlier than TODAY.
So SO_Date >= Today() is the condition I want to be checked at the time of saving or submitting a SO.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.
// if there is existing content in custom_validate paste only this part within the curly braces of custom_validate
if (wn.datetime.get_day_diff(new Date(), wn.datetime.str_to_obj(doc.transaction_date)) > 0) {
validated = false;
msgprint(“Sales Order Date cannot be a past date”); // or any other message you want…
}
// paste till here
}
thanks,
Anand.
On 13-Aug-2012, at 1:02 PM, Aditya Duggal <ad…@gmail.com> wrote:
Hi Anand,
This works fine but only one problem that the Validation fails when the date is equal to the system date as well and in the code I cannot see anything which should reject the validation on the basis of the sales order date being equal to the Today’s Date.
On Monday, August 13, 2012 11:24:39 AM UTC+5:30, Anand Doshi wrote:
Hi Aditya,
There is a syntax error in the reply I sent… please find the corrected script below:
// if there is existing content in custom_validate paste only this part within the curly braces of custom_validate
if (wn.datetime.str_to_obj(doc.transaction_date) < new Date()) {
validated = false;
msgprint(“Sales Order Date cannot be a past date”); // or any other message you want…
}
// paste till here
}
Thanks,
Anand.
On 11-Aug-2012, at 8:09 PM, Aditya Duggal <ad…@gmail.com> wrote:
I need help to write a small custom script which would check the Sales Order Date with the current date at the time of SAVING or SUBMITTING a SO and would not allow the user to save or submit it on a date which earlier than TODAY.
So SO_Date >= Today() is the condition I want to be checked at the time of saving or submitting a SO.
–
You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.