Provisioning now restores all GUI customizations on reset+reprovision: - create_pod_espocrm.sh: deploy the version-controlled espocrm-custom/ tree (CTag entity, layouts, i18n, clientDefs, custom views, custom CSS) into the pod, then chown www-data and rebuild. Replaces the earlier inline CSS-only step. Adds a live-phase cache rebuild so customizations and the client cacheTimestamp are refreshed on every run. - espocrm-custom/: snapshot of custom/ and client/custom/ (source of truth). - snapshot_espocrm_custom.sh: refresh the snapshot from a running pod. - readme.md: usage, first-time host setup, image-update and reset workflows. - Include the task/instruction notes and plan.md for reference. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4.8 KiB
Task: Disable the inline "Create" button on the Tags relationship panels in EspoCRM
Goal
This EspoCRM instance has a custom many-to-many relationship to a custom Tag entity. It is exposed as a "Tags" bottom relationship panel on three entity types: Opportunity, Contact, and Account. On each of these three entities the link is named cTags.
Right now the Tags panel offers a Create (+) button plus a three-dots (⋯) menu that contains the actions View list and Select. We want to remove only the inline Create (+) button on these Tags panels, so that users can attach existing Tag records only (a controlled tag vocabulary), using the ⋯ → Select action. Creating new tags must still be possible, but only via the Tag entity's own list view — never inline from a record's Tags panel. This must apply to all users, including regular (non-admin) users.
Do not change anything else (no other panels, fields, ACLs, or entities).
Environment
- EspoCRM runs as a rootless Podman pod named
espocrm_podon this server. The web container is expected to beespocrm_ctr(confirm withpodman ps). - EspoCRM application root inside the web container:
/var/www/html. The app runs as userwww-data. - Customizations live under
/var/www/html/custom/Espo/Custom/Resources/metadata/and survive upgrades. This path must be on the persisted volume/bind-mount so the change is not lost when the container is recreated.
Mechanism
EspoCRM reads relationship-panel options from clientDefs.<EntityType>.relationshipPanels.<linkName>. Setting "create": false for a panel hides its Create (+) button while keeping the ⋯ menu actions (View list / Select). EspoCRM deep-merges metadata, so we add only this single key per entity and do not redefine the whole panel.
Confidence note on the key name: it is almost certainly create. Before relying on it, verify against this version's frontend source, e.g.:
grep -rn "'create'\|\"create\"\|create:" /var/www/html/client/src/views/record/panels/relationship.js
grep -rn "relationshipPanels" /var/www/html/client/src/views/record/
Look at how the relationship panel decides whether to show the create action. If this version uses a different key (e.g. createDisabled), use the verified key instead and adjust the JSON below accordingly.
Steps
-
Confirm container and link name.
podman ps→ identify the web container (expectedespocrm_ctr).- Confirm each of
Opportunity,Contact,Accounthas a many-to-many link namedcTagspointing to entityTag, e.g.:podman exec espocrm_ctr sh -lc "grep -rn 'cTags' /var/www/html/custom/Espo/Custom/Resources/metadata/entityDefs/"
-
Add the override for each of the three entities. For
Opportunity,Contact, andAccount, ensure the file/var/www/html/custom/Espo/Custom/Resources/metadata/clientDefs/<EntityType>.jsoncontains this key:{ "relationshipPanels": { "cTags": { "create": false } } }- Target files:
/var/www/html/custom/Espo/Custom/Resources/metadata/clientDefs/Opportunity.json/var/www/html/custom/Espo/Custom/Resources/metadata/clientDefs/Contact.json/var/www/html/custom/Espo/Custom/Resources/metadata/clientDefs/Account.json
- If a file already exists, MERGE this key into the existing JSON (preserve all other keys; if
relationshipPanelsalready exists, addcTagsto it). Do not overwrite. - If a file or the directory does not exist, create it. Produce valid JSON.
- Target files:
-
Fix ownership so the web user owns the new/changed files (run as root inside the container):
podman exec espocrm_ctr chown -R www-data:www-data /var/www/html/custom/Espo/Custom/Resources/metadata/clientDefs -
Clear cache and rebuild (run as the web user):
podman exec -u www-data espocrm_ctr php command.php rebuildIf
command.phpis not present in this version, use:podman exec -u www-data espocrm_ctr bin/command rebuild(Alternatively, an admin can run Administration → Rebuild in the web UI.)
-
Verify in the browser (ideally as a regular non-admin user, and also as admin):
- Open an Opportunity, a Contact, and an Account record. The Tags panel must now have no Create (+) button. The three-dots (⋯) menu must still offer View list and Select, so existing tags can still be attached via ⋯ → Select.
- The Tag entity's own list view must still have its Create button (deliberate tag creation still works there).
- Attaching an existing tag via ⋯ → Select must still work.
Rollback
Remove the added relationshipPanels.cTags key from the three clientDefs files (or delete the files if they contained only this key), then rebuild again.