This only happens after I do a minor upgrade in version-13.
I have a DocType, which is a Child Table, and is Editable Grid. The fields have 1 row, and in Options I specified 2 other DocType. Originally its name is DIY Icon Type.
I created a new DocType with name DIY Icon Type 1, with the same content, pointing to DIY Simple and DIY Video. Everything remain the same. In DocType User, I now use DIY Icon Type 1 instead of DIY Icon Type and perform a Save again.
The result is the same; all rows are still removed before Saving.
I think the problem is the front end.
Can someone share what they think this issue might be?
If you havent made any changes in code that’s causing this. Then the problem is due to permission error. Click on Edit in “Your icons Settings” field. Then enable ignore permissions. Your issue will be resolved.
Line 68 is from the non-working, newer Frappe/ERPNext, while line 69 is from the working instance, which is a bit older.
Now, the reason why the newly added rows in Child Table vanish is because these records are put into the variable modified_table_fields in the non-working instance; they are not being put into modified_table_fields in the working instance.
Once the rows are in modified_table_fields, the lines below:
Now, when I try to use API to retrieve the Child Table, I can’t. The same API call, no change, but now I get frappe.exceptions.PermissionError.
Could this be the source of issue? I don’t have permission, so new entries in the Child Table will be considered blank, so they are removed prior to Saving?
Nice! It seems that the software just demonstrated that it indeed hinders someone without permissions from manipulating a table or object they don’t have permission to change.
So this would increase the trust level one has for the software.
But you might want to check which permissions apply to which object so you know well how to configure these in order to get the permission/lockdown results you want or need.
I had the same issue and solved it by using a promise-based approach: To make sure the database calls are completed before the save operation, it’s good to use promises. This ensures all operations are done sequentially and then update dirty state after updating the values: frm.dirty() marks the form as having changes, and it should be called after you have completed updating all the fields to ensure that the form gets saved correctly.
Child Tables are not available in JS from frappe.db.['orm function'] where orm function is get_list, get_value, etc. You need to create a custom endpoint to load these with @frappe.whitelist()