diff options
Diffstat (limited to 'archaeological_finds/models_treatments.py')
| -rw-r--r-- | archaeological_finds/models_treatments.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index b8ed79a62..5054d0da1 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -33,7 +33,7 @@ from ishtar_common.models import GeneralType, ImageModel, BaseHistorizedItem, \ ValueGetter, post_save_cache, ShortMenuItem from archaeological_warehouse.models import Warehouse, Container from archaeological_finds.models_finds import Find, FindBasket -from archaeological_operations.models import ClosedItem +from archaeological_operations.models import ClosedItem, Operation class TreatmentType(GeneralType): @@ -126,6 +126,14 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): end_date = models.DateField(_(u"Closing date"), blank=True, null=True) container = models.ForeignKey(Container, verbose_name=_(u"Container"), blank=True, null=True) + estimated_cost = models.FloatField(_(u"Estimated cost"), + blank=True, null=True) + quoted_cost = models.FloatField(_(u"Quoted cost"), + blank=True, null=True) + realized_cost = models.FloatField(_(u"Realized cost"), + blank=True, null=True) + insurance_cost = models.FloatField(_(u"Insurance cost"), + blank=True, null=True) target_is_basket = models.BooleanField(_(u"Target a basket"), default=False) cached_label = models.TextField(_(u"Cached name"), null=True, blank=True) @@ -179,6 +187,10 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): owns, key=lambda x: x.cached_label if hasattr(x, 'cached_label') else unicode(x)) + def get_query_operations(self): + return Operation.objects.filter( + context_record__base_finds__find__downstream_treatment=self) + def _generate_cached_label(self): items = [unicode(getattr(self, k)) for k in ['year', 'index', 'other_reference', 'label'] if |
