summaryrefslogtreecommitdiff
path: root/ishtar/ishtar_base/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2011-07-05 15:15:41 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2011-07-05 15:15:41 +0200
commit95ca7db2c23a3d13800ebe794355a12699bb7944 (patch)
tree5c528867399e26cb0e27334dcf41f9cc84e759d8 /ishtar/ishtar_base/models.py
parent734ce2a8c963f07221d33416bfa6bcb03982e923 (diff)
downloadIshtar-95ca7db2c23a3d13800ebe794355a12699bb7944.tar.bz2
Ishtar-95ca7db2c23a3d13800ebe794355a12699bb7944.zip
Display cost on Operation sheet (closes #442)
Diffstat (limited to 'ishtar/ishtar_base/models.py')
-rw-r--r--ishtar/ishtar_base/models.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/ishtar/ishtar_base/models.py b/ishtar/ishtar_base/models.py
index 1e9cf9b21..42b79f163 100644
--- a/ishtar/ishtar_base/models.py
+++ b/ishtar/ishtar_base/models.py
@@ -685,6 +685,24 @@ class Operation(BaseHistorizedItem, OwnPerms):
def is_own(self, person):
return False
+
+ @property
+ def surface_ha(self):
+ if self.surface:
+ return self.surface/10000.0
+
+ @property
+ def cost_by_m2(self):
+ if not self.surface or not self.cost:
+ return
+ return round(float(self.cost)/self.surface, 2)
+
+ @property
+ def cost_by_m2(self):
+ if not self.surface or not self.cost:
+ return
+ return round(float(self.cost)/self.surface, 2)
+
@classmethod
def get_query_owns(cls, user):
return Q(in_charge=user.person)|Q(history_modifier=user)\