added get_inventory_logs_of_type() to Asset
This commit is contained in:
1 parent
6c1e9f63f2
commit
0bb91c25b7
3 files changed
+16
-3
No files matched your search
@@ -23,6 +23,19 @@ class Asset(jsonapi_requests.orm.ApiModel):
|
||||
break;
|
||||
return related
|
||||
|
||||
def get_inventory_logs_of_type(self, type):
|
||||
if not issubclass(type, Log.Log):
|
||||
raise ValueError("type specified is not a type of log use for example: get_logs_of_type(Log.Harvest)")
|
||||
logs = type.get_list()
|
||||
related = []
|
||||
for log in logs:
|
||||
for quantity in log.quantities:
|
||||
if quantity.inventory_asset:
|
||||
if quantity.inventory_asset.id == self.id:
|
||||
related.append(log)
|
||||
break;
|
||||
return related
|
||||
|
||||
class Land(Asset):
|
||||
class Meta(Asset.Meta):
|
||||
name = 'land'
|
||||
|
||||
Reference in new issue
Block a user