Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
`frappe.get_meta(doctype).has_field("name")` returns `False` for Custom DocTypes on PostgreSQL (Frappe v15.67.0), breaks `frappe.get_list` | GoodFirstPicks

`frappe.get_meta(doctype).has_field("name")` returns `False` for Custom DocTypes on PostgreSQL (Frappe v15.67.0), breaks `frappe.get_list`

frappe/frappe 0 comments 1mo ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeFrappe / ERPNextPython

Why this is a good first issue

The issue involves PostgreSQL-specific behavior with custom DocTypes and schema synchronization.

AI Summary

The issue involves PostgreSQL-specific behavior where `frappe.get_meta(custom_doctype).has_field("name")` returns `False` for custom DocTypes, causing downstream errors in `frappe.get_list`. Additionally, schema synchronization fails to populate `search_fields` correctly. The problem is specific to custom DocTypes and PostgreSQL, requiring investigation into schema handling and metadata management.

Issue Description

Description of the issue

frappe.get_meta(custom_doctype).has_field("name") consistently returns False for custom DocTypes defined in apps when using PostgreSQL. This prevents filtering/searching by the name field and causes a downstream AttributeError: 'list' object has no attribute 'lower' in DatabaseQuery.sanitize_fields when using frappe.get_list with certain filters (e.g., OR conditions).

Additionally, the schema synchronization process (bench migrate or bench reload-doctype) fails to populate the search_fields column in the tabDocType table based on the in_global_search flags set on fields within the DocType definition JSON and tabDocField table.

The issue appears specific to custom DocTypes, as standard Frappe DocTypes (e.g., "User", "ToDo") correctly return True for meta.has_field("name"). The problem persists even after simplifying the custom DocType definition to a minimal structure and running bench update --reset.

Context information (for bug reports)

Output of bench version

firebase admin initialized successfully!
frappe 15.67.0
frappe_s3_attachment 0.0.1
frappe_types 0.0.1
nirmaan_crm 0.0.1
nirmaan_stack 0.0.1

Database: PostgreSQL 14.11 (Debian package 14.11-1.pgdg120+2) Environment: Running via official Frappe Docker images (likely frappe/frappe-worker, frappe/frappe-nginx, postgres:14)

Steps to reproduce the issue

  1. Set up a Frappe v15.67.0 instance using PostgreSQL 14+ as the database backend.
  2. Create a new custom app (e.g., bench new-app my_app).
  3. Install the app (bench --site localhost install-app my_app).
  4. Define a simple custom DocType within the app (e.g., my_app/doctype/test_item/test_item.json):
    {
        "doctype": "DocType",
        "name": "Test Item",
        "module": "My App",
        "engine": "InnoDB",
        "naming_rule": "By fieldname",
        "autoname": "item_code",
        "fields": [
            {
                "fie
    

GitHub Labels

bugpostgres

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • PostgreSQL-specific
  • custom DocTypes
  • schema synchronization
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno
AssigneeAarDG10