I need to insert values of the child table directly in the database, but the problem that I do not know what I have to set the name value to be same as the one that is generated when I am adding the record from the application. Appreciate if someone can help and advise please.
Below is image for the database table of the child table that shows the name field and its values, so how I can set a value that is same shape of those values that are generated from the application?
I need to insert the record using script and not manual insert so data import tool can do nothing here.
I need to insert the record using frappe.db.sql in python.
I am just asking what the value of name field should be set when I am inserting the record in the database table, so still I need to know what I have to set before writing the code
The name field is auto generated by the system as a primary key. I think inserting directly into the DB is not the best method, as you will be bypassing a lot of good things the framework offers, like logging trails.
@kolate_sambhaji
frappe.get_doc can be used to read the values and not to set the values.
Again, I need to insert values in the child table of the existed parent document.
Regards
Bilal
I need to insert new values in the child table which is empty (and of course the parent document is existed).
What you mentioned for sure it does not work.
Below is the image that declares that button that I need to click on it (which is Get Employees Who Leaved), so the action will be is to fill the child table that is below the button in the employees who leaved.
I need the method to insert the employees that leaved in the child table (that is determined in the green color) as shown in the below image.
Do you mean that the d.insert(ignore_permissions=True) will insert the child table in the application and once the user clicked on save, then it will be saved to to the database and will generate a proper name to be placed in the name field in the database?