Minor enhancements

* refactors eco account rest surface calculation into designated method get_available_rest()
* refactors placeholder setter for BaseForm
* adds automatic eco account identifier generating on saving
* fixes ServerMessageImportance template tag
This commit is contained in:
mipel
2021-08-11 14:17:43 +02:00
parent 5f85f49636
commit c8b6d001ef
8 changed files with 77 additions and 15 deletions
+3
View File
@@ -67,6 +67,7 @@ class NewPaymentForm(BaseModalForm):
self.intervention = self.instance
self.form_title = _("Payment")
self.form_caption = _("Add a payment for intervention '{}'").format(self.intervention.title)
self.add_placeholder_for_field("amount", "0,00")
def save(self):
with transaction.atomic():
@@ -110,6 +111,7 @@ class NewStateModalForm(BaseModalForm):
super().__init__(*args, **kwargs)
self.form_title = _("New state")
self.form_caption = _("Insert data for the new state")
self.add_placeholder_for_field("surface", "0,00")
def save(self, is_before_state: bool = False):
with transaction.atomic():
@@ -286,6 +288,7 @@ class NewActionModalForm(BaseModalForm):
super().__init__(*args, **kwargs)
self.form_title = _("New action")
self.form_caption = _("Insert data for the new action")
self.add_placeholder_for_field("amount", "0,00")
def save(self):
with transaction.atomic():