Cdt and cd in function(doc, cdt, cd) & custom_delivery_date

Hello;

I would like to know the arguments cdt and cd that is used in the function(doc, cdt, cd) are the username and password to connect to the database? They are shortcut for what?
In other words, why we did not user db_user and db_pass?

From the other side, the cur_frm.cscript.custom_delivery_date = function(doc, cdt, cd) means to run the function once the delivery_date is entered and does not mean that it is the returned value of the the function, right?

cur_frm.cscript.custom_delivery_date = function(doc, cdt, cd){
cur_frm.set_value(“production_due_date”, frappe.datetime.add_days(doc.delivery_date, -2));
}

Thanks for the kindly help and support.
Regards
Bilal

cdt and cdn are the variables which hold the doctype and docname information

cdt = child doctype, cdn = child docname

I have a question here about the childname: the child docname is the name of the table that is inserted in the parent document?

Appreciate the kindly help.
Regards
Bilal

Yes, it is the name of child (row) document in parent

1 Like

Thanks a lot for the help and advise.

The question here is: The custom_delivery_date means that this script will be run when delivery date is selected?

Regards
Bilal

Hi,
Is there a way to run the script in the case the date is already in the field?

There should be an event to run the script.
Or, u can add a button, so when clicking on it, the script will run.
Regards
Bilal