Skip to content

Commit d89b986

Browse files
authored
Merge pull request #651 from OpenSPP/594-species
restrict deletion of species if already assigned to a record
2 parents c99c514 + a997244 commit d89b986

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

spp_farmer_registry_base/models/agricultural_activity.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ class AgriculturalActivity(models.Model):
3131
],
3232
)
3333

34-
species_id = fields.Many2one("spp.farm.species", string="Species", domain="[('species_type', '=', activity_type)]")
34+
species_id = fields.Many2one(
35+
"spp.farm.species", ondelete="restrict", string="Species", domain="[('species_type', '=', activity_type)]"
36+
)
3537

3638
@api.onchange("crop_farm_id")
3739
def _onchange_farm_id(self):

0 commit comments

Comments
 (0)