diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index a0ba0f20..05af6f9b 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -1262,16 +1262,18 @@ class Computer(Device): @property def ram_size(self) -> int: """The total of RAM memory the computer has.""" - return sum( - ram.size or 0 for ram in self.components if isinstance(ram, RamModule) - ) + components = self.components + if self.placeholder and self.placeholder.binding: + components = self.placeholder.binding.components + return sum(ram.size or 0 for ram in components if isinstance(ram, RamModule)) @property def data_storage_size(self) -> int: """The total of data storage the computer has.""" - return sum( - ds.size or 0 for ds in self.components if isinstance(ds, DataStorage) - ) + components = self.components + if self.placeholder and self.placeholder.binding: + components = self.placeholder.binding.components + return sum(ds.size or 0 for ds in components if isinstance(ds, DataStorage)) @property def processor_model(self) -> str: diff --git a/ereuse_devicehub/templates/inventory/erasure.html b/ereuse_devicehub/templates/inventory/erasure.html index 130ca3c1..681f31a6 100644 --- a/ereuse_devicehub/templates/inventory/erasure.html +++ b/ereuse_devicehub/templates/inventory/erasure.html @@ -288,10 +288,10 @@ {% for erasure in erasures %} - {{ erasure.device.serial_number.upper() }} + {{ erasure.device.serial_number and erasure.device.serial_number.upper() or '' }} - {{ erasure.parent.serial_number.upper() }} + {{ erasure.parent.serial_number and erasure.parent.serial_number.upper() or '' }} {{ erasure.get_public_name() }}