Closed
Description
Description of the issue
Virtual fields content is not displayed anymore in child grids.
The cell remains blank instead of showing the virtual field result.
Context information (for bug reports)
Output of bench version
frappe 14.30.0
(custom app)
Steps to reproduce the issue
- Create a field as virtual in a child doctype
- Implement the backend code thru a @Property
- Add a grid to your doctype to display the child doctype
Observed result
The backend code is well executed, but the result is not displayed client-side in the corresponding column of the child grid (even though the user has full permissions to view it)
Expected result
The result of the virtual field computation should be displayed.
Solution
in file:
/apps/frappe/frappe/model/base_document.py
in method:
get_valid_dict()
this line:
permitted_fields = get_permitted_fields(doctype=self.doctype)
should be replaced by:
if parent_doc := getattr(self, "parent_doc", None):
permitted_fields = get_permitted_fields(doctype=self.doctype, parenttype=parent_doc.doctype)
else:
permitted_fields = get_permitted_fields(doctype=self.doctype)