diff --git a/src/ralph/data_center/models/physical.py b/src/ralph/data_center/models/physical.py index 8b0298c2e7..d1a10ede5a 100644 --- a/src/ralph/data_center/models/physical.py +++ b/src/ralph/data_center/models/physical.py @@ -461,6 +461,17 @@ class DataCenterAsset( choices=Orientation(), default=Orientation.front.id, ) + vendor_contract_number = models.CharField( + null=True, + blank=True, + max_length=256, + verbose_name=_('Vendor contract number'), + ) + leasing_rate = models.FloatField( + null=True, + blank=True, + verbose_name=_('Vendor contact number'), + ) slot_no = models.CharField( blank=True, help_text=_('Fill it if asset is blade server'), diff --git a/src/ralph/data_center/tests/test_api.py b/src/ralph/data_center/tests/test_api.py index a566d51c52..4e19719bb8 100644 --- a/src/ralph/data_center/tests/test_api.py +++ b/src/ralph/data_center/tests/test_api.py @@ -234,6 +234,20 @@ def test_patch_data_center_asset(self): self.assertTrue(self.dc_asset.force_depreciation) self.assertEqual(self.dc_asset.tags.count(), 1) + def test_update_vendor_contract_number_and_leasing_rate(self): + url = reverse('datacenterasset-detail', args=(self.dc_asset.id,)) + hostname = self.dc_asset.hostname + data = { + 'vendor_contract_number': 'abc-123', + 'leasing_rate': 123.45 + } + response = self.client.patch(url, data, format='json') + self.assertEqual(response.status_code, status.HTTP_200_OK) + self.dc_asset.refresh_from_db() + self.assertEqual(self.dc_asset.hostname, hostname) + self.assertEqual(self.dc_asset.vendor_contract_number, 'abc-123') + self.assertEqual(self.dc_asset.leasing_rate, 123.45) + def test_filter_by_configuration_path(self): url = reverse('datacenterasset-list') + '?configuration_path={}'.format( self.dc_asset.configuration_path.path,