Merge pull request #367 from eReuse/bugfix/3848-phid-erasure-host

get the phid of the computer from where created
This commit is contained in:
cayop 2022-09-26 17:42:00 +02:00 committed by GitHub
commit 8627a7dd5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -476,9 +476,12 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
return urlutils.URL(url_for_resource('Document', item_id=self.id)) return urlutils.URL(url_for_resource('Document', item_id=self.id))
def get_phid(self): def get_phid(self):
if self.device and self.device.parent: """This method is used for get the phid of the computer when the action
if hasattr(self.device.parent, 'phid'): was created. Usefull for get the phid of the computer were a hdd was
return self.device.parent.phid() Ereased
"""
if self.snapshot:
return self.snapshot.device.phid()
return '' return ''
def __str__(self) -> str: def __str__(self) -> str: