diff options
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 |
commit | 95ca7db2c23a3d13800ebe794355a12699bb7944 (patch) | |
tree | 5c528867399e26cb0e27334dcf41f9cc84e759d8 /ishtar/ishtar_base/models.py | |
parent | 734ce2a8c963f07221d33416bfa6bcb03982e923 (diff) | |
download | Ishtar-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.py | 18 |
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)\ |