Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't save any row in child table when I am linking 2 docfield to the same child table #24556

Closed
stockarea opened this issue Jan 27, 2024 · 3 comments · Fixed by #26269
Closed

Comments

@stockarea
Copy link

I have a single child table - Documents.

I have the main table - A

Now I have 2 fields, lets say field1 and field2 , both of type Table and linked to child table Documents.

But I am not able to save any row in this field1 and field2.

When I am linking only single field1 or field2 its working, but not on both.

Frappe Version : 15.7.0

@stockarea stockarea added the bug label Jan 27, 2024
@git-avc
Copy link
Contributor

git-avc commented Jan 28, 2024

Hi:

I can reproduce it (develop branch) only under this conditions:

  • 2 table fields pointing to the same child table
  • No field with "In list view" property checked on in child doctype

Reference: https://discuss.frappe.io/t/i-cant-save-any-row-in-child-table-when-i-am-linking-2-docfield-to-the-same-child-table/116366
Maybe related to this too: https://discuss.frappe.io/t/multiselect-field-doesnt-work/114556

@niraj2477
Copy link
Contributor

niraj2477 commented Apr 9, 2024

2 table fields pointing to the same child table

had the same result with 1 table field

Data is being cleared from this JS function remove_empty_rows.
https://github.com/frappe/frappe/blob/develop/frappe/public/js/frappe/form/save.js#L43

const in_list_view_cells = cells.filter(function(df) {
	return cint(df.in_list_view) === 1;
});

instead of checking for list_view, we can check if whole row is empty.

@git-avc
Copy link
Contributor

git-avc commented Apr 10, 2024

@niraj2477 Yes, I can now reproduce it with just one table.

Sometimes df.in_list_view = 0, so in_list_view_cells is empty. In my case, I reproduce it after editing doctype (without changing anything on it) ... IDK why.

I added if (is_empty_row(in_list_view_cells) && in_list_view_cells.length>0) in line 77, to avoid row deleting when no fields with in_list_view =1. It's working but IDK if is the proper way to fix it.

Check this recording, row is not deleted now because my change. Added some console printing; as you can see list_view_cells is empty.

child_empty_row

Maybe your approach makes more sense.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants