# Document views refactoring
* refactors new, edit, get and delete views for eiv, kom, oek and ema * introduces
This commit is contained in:
@@ -6,11 +6,11 @@ Created on: 18.08.22
|
||||
|
||||
"""
|
||||
from intervention.models import InterventionDocument
|
||||
from konova.forms.modals import NewDocumentModalForm
|
||||
from konova.forms.modals import NewDocumentModalForm, EditDocumentModalForm, RemoveDocumentModalForm
|
||||
|
||||
|
||||
class NewInterventionDocumentModalForm(NewDocumentModalForm):
|
||||
document_model = InterventionDocument
|
||||
_DOCUMENT_CLS = InterventionDocument
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
""" Extension of regular NewDocumentModalForm
|
||||
@@ -28,3 +28,31 @@ class NewInterventionDocumentModalForm(NewDocumentModalForm):
|
||||
self.instance.send_data_to_egon()
|
||||
|
||||
return doc
|
||||
|
||||
class EditInterventionDocumentModalForm(EditDocumentModalForm):
|
||||
_DOCUMENT_CLS = InterventionDocument
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
""" Extension of regular EditDocumentModalForm
|
||||
|
||||
Checks whether payments exist on the intervention and sends the data to EGON
|
||||
|
||||
Args:
|
||||
*args ():
|
||||
**kwargs ():
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
doc = super().save(*args, **kwargs)
|
||||
self.instance.send_data_to_egon()
|
||||
|
||||
return doc
|
||||
|
||||
|
||||
class RemoveInterventionDocumentModalForm(RemoveDocumentModalForm):
|
||||
_DOCUMENT_CLS = InterventionDocument
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
super().save(*args, **kwargs)
|
||||
self.instance.send_data_to_egon()
|
||||
|
||||
Reference in New Issue
Block a user