summaryrefslogtreecommitdiff
path: root/archaeological_finds/forms_treatments.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-01-11 11:43:43 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-01-11 11:43:43 +0100
commitaaee64cb571a5efb34a0b37a591741aa90cb34de (patch)
treeb90b1997c7521e23827e133506ed51bf66bffb18 /archaeological_finds/forms_treatments.py
parent7c4ecc3483bd1b6c608758bd4ca76c9648bb93a8 (diff)
downloadIshtar-aaee64cb571a5efb34a0b37a591741aa90cb34de.tar.bz2
Ishtar-aaee64cb571a5efb34a0b37a591741aa90cb34de.zip
Treatements: add cost fields
Diffstat (limited to 'archaeological_finds/forms_treatments.py')
-rw-r--r--archaeological_finds/forms_treatments.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py
index 40d241d88..3c6668c9d 100644
--- a/archaeological_finds/forms_treatments.py
+++ b/archaeological_finds/forms_treatments.py
@@ -27,7 +27,8 @@ from django.db.models import Max
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
-from ishtar_common.models import Person, valid_id, Organization
+from ishtar_common.models import Person, valid_id, Organization, \
+ get_current_profile
from archaeological_operations.models import ActType, AdministrativeAct
from archaeological_warehouse.models import Warehouse, Container
import models
@@ -138,6 +139,14 @@ class BaseTreatmentForm(ManageOldType, forms.Form):
widget=widgets.JQueryDate)
end_date = forms.DateField(label=_(u"Closing date"), required=False,
widget=widgets.JQueryDate)
+ estimated_cost = forms.FloatField(label=_(u"Estimated cost ({currency})"),
+ required=False)
+ quoted_cost = forms.FloatField(label=_(u"Quoted cost ({currency})"),
+ required=False)
+ realized_cost = forms.FloatField(label=_(u"Realized cost ({currency})"),
+ required=False)
+ insurance_cost = forms.FloatField(label=_(u"Insurance cost ({currency})"),
+ required=False)
image = forms.ImageField(
label=_(u"Image"), help_text=mark_safe(
_(u"<p>Heavy images are resized to: %(width)dx%(height)d "
@@ -149,6 +158,13 @@ class BaseTreatmentForm(ManageOldType, forms.Form):
def __init__(self, *args, **kwargs):
user = kwargs.pop('user')
super(BaseTreatmentForm, self).__init__(*args, **kwargs)
+ # set current currency
+ currency = get_current_profile().currency
+ for key in ('estimated_cost', 'quoted_cost', 'realized_cost',
+ 'insurance_cost'):
+ self.fields[key].label = self.fields[key].label.format(
+ currency=currency)
+
q = Person.objects.filter(ishtaruser__pk=user.pk)
if q.count():
person = q.all()[0]