Skip to content

SidePanelLayout missing auto-create for Link fields #2423

Description

@andropl

Description

SidePanelLayout.vue passes :onCreate="field.create" to the <Link> component (line 194), but never auto-assigns field.create for Link fields. This means the "Create New" button in Link field dropdowns only appears when field.create is explicitly set by the parent page (e.g., the address field in Organization.vue).

In contrast, Field.vue (used by FieldLayout in modals like OrganizationModal) has auto-create logic that works for all Link fields:

// Field.vue — auto-create for every Link field (non-User)
if (field.fieldtype === 'Link' && field.options !== 'User') {
  if (!field.create) {
    field.create = (value, close) => {
      const callback = (d) => {
        if (d) fieldChange(d.name, field)
      }
      createDocument(field.options, value, close, callback)
    }
  }
}

SidePanelLayout.vue has no equivalent logic.

Steps to reproduce

  1. Add a custom Link field to CRM Organization (e.g., linking to a custom DocType)
  2. Open an existing organization (sidepanel view, rendered by SidePanelLayout)
  3. Click the Link field dropdown → no "Create New" button
  4. Now open the "New Organization" modal (rendered by FieldLayoutField.vue) → "Create New" button IS shown for the same field

Expected behavior

"Create New" button should appear in Link field dropdowns in both the sidepanel view and the modal, consistently.

Affected component

frontend/src/components/SidePanelLayout.vue — needs the same auto-create logic that frontend/src/components/FieldLayout/Field.vue already has.

Environment

  • FCRM v1.76.0
  • Frappe v16.25.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions