-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Describe the bug
Paul Blom reported agent merging failure and sent the crash reports included below. The error message is as follows:
deletion.ProtectedError: ("Cannot delete some instances of model 'Agent' because they are referenced through protected foreign keys: 'Address.createdbyagent', 'Address.modifiedbyagent', 'Agentspecialty.createdbyagent', 'Agentspecialty.modifiedbyagent'.", {<Address: Address object (33)>, <Agentspecialty: Agentspecialty object (1)>, <Agentspecialty: Agentspecialty object (2)>, <Agentspecialty: Agentspecialty object (3)>, <Agentspecialty: Agentspecialty object (4)>, <Agentspecialty: Agentspecialty object (5)>, <Agentspecialty: Agentspecialty object (6)>, <Agentspecialty: Agentspecialty object (7)>, <Agentspecialty: Agentspecialty object (8)>, <Address: Address object (25)>, <Address: Address object (28)>, <Address: Address object (29)>, <Address: Address object (30)>, <Address: Address object (31)>}
This error is related to PR #4699 and Issue #4685. The potential of this error remaining for other cases is mentioned in @melton-jason #4699 (comment)
While this issue and the one mentioned in #4685 (comment) only
mention CollectionObject -> Cataloger, the Issue still likely applies in similar relationships from Agent (untested).
The concern with this case, especially, is that the preventing fields are read-only, and thus can't be easily edited to workaround the merging error.
To Reproduce
Steps to reproduce the behavior:
- Find agent records where at least one is referenced as on Address or AgentSpecialty records for other Agents (or replicate reporting issue with test panel and crash report)
- Attempt merge
- See Error
Expected behavior
Successful merge
Crash Report
Merging.79770e27-ae5a-4c5e-92eb-d28311ab500f.Crash.Report.-.2024-07-09T17_55_58.633Z.txt
Please fill out the following information manually:
- OS: macOS and Windows (Paul relayed that most of the museum uses Windows)
- Browser: Chrome
- Specify 7 Version:
v711-prerelease(Behavior is consistent inv7.10) - Database Name: ojsmnh
- Collection name: Invertebrates
- User Name:
pblom - URL: https://ojsmnh.specifycloud.org/specify/overlay/merge/Agent/?records=947%2C946
Reported By
Paul Blom @ Orma J. Smith Museum of Natural History - The College of Idaho
Additional Context
Linked Record button in the merge dialog shows the count of all linked records and their tables. Clicking a table/field's count allows browse in forms of those records.
Although this doesn't reveal which links may prevent a successful merge from this, it is a helpful way to easily view and access linked records for a given agent.