Skip to content

Automatically created Preparation in a button not assigned a PrepTypeID #3094

@grantfitzsimmons

Description

@grantfitzsimmons

If a user on the New Mexico database does not click on the Preparations button before trying to save, they receive a 500 error.

image

To Recreate:

  1. Create a new Collection Object record naturally on the newmexico2 database without clicking on Preparations (see that the count is 1)
  2. See error

In production (v7.7.5):
image

In development (v7.8.7.1):
image

Specify 7 Crash Report - 2023-03-04T00 18 40.519Z.txt

IntegrityError at /api/specify/collectionobject/ (1048, "Column 'PrepTypeID' cannot be null") Request Method: POST Request URL: http://newmexico2-v7871-fix.test.specifysystems.org/api/specify/collectionobject/ Django Version: 3.2.15 Python Executable: /opt/specify7/ve/bin/python3.8 Python Version: 3.8.0 Python Path: ['/opt/specify7', '/opt/specify7', '/opt/specify7/ve/bin', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/opt/specify7/ve/lib/python3.8/site-packages', '/opt/specify7'] S

Expected Behavior:
You should be able to create a new record without opening the Preparations button before saving. It should assign a PrepTypeID by default based on the form

newmexico2 database
Happens on v7.7.5, v7.8.5, v7.8.7.1, and edge

Form definition: (/specify/resources/view-set/1/)

<cell type="label" labelfor="" label="Preparations"/>
<cell type="subview" id="8" viewname="Preparation" name="preparations" initialize="align=left;btn=true;icon=preparation"/>

Metadata

Metadata

Assignees

Labels

1 - BugIncorrect behavior of the product2 - FormsIssues that are related to the form system

Type

No type

Projects

Status

📋 Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions