Skip to content

CO without a CE ID when embedded=true crashes Loan Return #8410

Description

@bronwyncombs

Describe the bug
A clear and concise description of what the bug is.

When isEmbeddedCollectingEvent=true, Specify expects a CE ID for each CO loaded when processing a loan return preparation. If a loan preparation belongs to a CO without a CE, returning the loan will result in a crash. If a CE is added to the loan prep's CO, it can then be returned without error.

Note: CollectingEvent is not required relationship for CO in schema config and no save block prevents creating a CO without a CE via forms or WorkBench. In fact, in the case of the reporting institution, there are no required fields on CE and simply added a blank CE avoids the crash.

According to @melton-jason, this is a known issue as of v7.10. He describes it as:

specifically if you ( or Specify, behind the scenes) edit the Preparation when you're saving a Loan (also a way to do it with LoanPreparation).

See 57f9142#diff-cda0db91ab7dcb0a7df5c8540ecb3fd9d270ae1844e389ea767b755a2ead464bR12-R375

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://mhnf20260807-v7.test.specifysystems.org/specify/view/loan/6/
  2. Click on Return Loan > Select All > Apply
  3. Save Loan
  4. See crash

Expected Behavior

  1. No error upon loan return in this situation.
  2. Collection Objects should be able to exist without a Collecting Event, even if embedded. I.e., when "Required" is false for CollectingEvent on CollectionObject, then its ID shouldn't be required for COs.
  3. If CE is required, the business rule that adds the CE should only be active when the Collection Object is new, not for pre-existing COs.

Crash Report

Specify 7 Crash Report - 2026-08-07T06_56_39.060Z.txt

Please fill out the following information manually:

Reported By
Name of your institution
Musée d'histoire Naturelle Fribourg via 1212

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions