I have models: Contract and Incident.
In Incident form, I have button Send to Create and Send incident form.
When click Send button:
- Successfully: Check Room has Contract is Active -> Create Incident form + Change state to In Progress + Send noti.
- Failed: Check Room has not contract or Contract is Draft -> Not allow create Incident form + Show error message ( ValidationError("NotFoundAnywhereContractWithStateActive"))
Follow my code:
https://docs.google.com/document/d/1S2yev5sgDE86gu4ut2muT0aHSSMOMc8tv3ciYjJZCkI/edit