Skip to content

A free open source IT asset/license management system

Possible alternative to fixing #13296 - custom report failing when the model is busted

snipe540b09c506cf
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index 861269d5f2..95e1c3a166 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -390,7 +390,7 @@ class Asset extends Depreciable
*/
public function depreciation()
{
- return $this->model->belongsTo(\App\Models\Depreciation::class, 'depreciation_id');
+ return $this->hasOneThrough(\App\Models\Depreciation::class,\App\Models\AssetModel::class,'id','id','model_id','depreciation_id');
}