8000 Virtual fields display broken in child tables · Issue #20526 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Virtual fields display broken in child tables #20526
Closed
@vvrithof

Description

@vvrithof

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

  1. Create a field as virtual in a child doctype
  2. Implement the backend code thru a @Property
  3. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0