I am stuck with this strange issue for a very long time, any help is highly appreciated.
I have this doctype in older version (ERPNext: 7) which i moved(manually copied the folder and did bench migrate) to version 12. This doctype works fine in the old version but behaves bit weird in the new version.
The doctype looks like the image attached below, basically all it does is when i tick any checkbox in the master record, a corresponding row is added in the child table, when i un-tick a checkbox a corresponding row in the child table gets removed.
It works absolutely fine in the old version. But in the new version, when i un-tick one of the checkboxes, along with the un-ticked component in the child table, next following row also getting deleted and then an erroneous new record gets added at the bottom of the table with field labels as values as shown below.
After checking thoroughly, i figured that the issue happens exactly at the following piece of code from python side which basically removes the list of un-ticked components from the child table.
[self.remove(d) for d in del_list]
And the list
del_list contains proper values (i.e. the rows to be deleted). This issue happens only when i call the backend method from client script through frappe.call. And there are no errors in developer console either.
Following is the client side .js code that calls the method:
Following is the python side code:
Has anyone experienced similar issue? I have been stuck with this issue for a very long time. I have tried so many alternatives as mentioned below but the issue remains.
What i tried so far:
- I have deleted the child doctype and manually created again, but the issue remains.
- Thought the issue is with
self.removein Python3, so tried other ways of removing elements from the list using
del, still same issue.
- Commented out all the code following the line
[self.remove(d) for d in del_list]to confirm that the issue happens at the exact line mentioned.
- And several other alternatives