From a0c938c044db05ed08d10e96731a209122aaa83c Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 26 Sep 2022 17:22:01 +0200 Subject: [PATCH] get the phid of the computer from where created --- ereuse_devicehub/resources/action/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 9cf2ce54..496eed34 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -476,9 +476,12 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): return urlutils.URL(url_for_resource('Document', item_id=self.id)) def get_phid(self): - if self.device and self.device.parent: - if hasattr(self.device.parent, 'phid'): - return self.device.parent.phid() + """This method is used for get the phid of the computer when the action + was created. Usefull for get the phid of the computer were a hdd was + Ereased + """ + if self.snapshot: + return self.snapshot.device.phid() return '' def __str__(self) -> str: