Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ITS-368993 | Added new status to backoffice assets. #3725

Merged
merged 11 commits into from
Nov 8, 2022
20 changes: 20 additions & 0 deletions src/ralph/back_office/migrations/0013_auto_20220421_1202.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import ralph.lib.transitions.fields


class Migration(migrations.Migration):

dependencies = [
('back_office', '0012_auto_20210318_1230'),
]

operations = [
migrations.AlterField(
model_name='backofficeasset',
name='status',
field=ralph.lib.transitions.fields.TransitionField(default=1, choices=[(1, 'new'), (2, 'in progress'), (3, 'waiting for release'), (4, 'in use'), (5, 'loan'), (6, 'damaged'), (7, 'liquidated'), (8, 'in service'), (9, 'installed'), (10, 'free'), (11, 'reserved'), (12, 'sale'), (13, 'loan in progress'), (14, 'return in progress'), (15, 'to find'), (16, 'sent')]),
),
]
20 changes: 20 additions & 0 deletions src/ralph/back_office/migrations/0014_auto_20221108_1007.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import ralph.lib.transitions.fields


class Migration(migrations.Migration):

dependencies = [
('back_office', '0013_auto_20220421_1202'),
]

operations = [
migrations.AlterField(
model_name='backofficeasset',
name='status',
field=ralph.lib.transitions.fields.TransitionField(default=1, choices=[(1, 'new'), (2, 'in progress'), (3, 'waiting for release'), (4, 'in use'), (5, 'loan'), (6, 'damaged'), (7, 'liquidated'), (8, 'in service'), (9, 'installed'), (10, 'free'), (11, 'reserved'), (12, 'sale'), (13, 'loan in progress'), (14, 'return in progress'), (15, 'to find'), (16, 'sent'), (17, 'buyout')]),
),
]
2 changes: 2 additions & 0 deletions src/ralph/back_office/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class BackOfficeAssetStatus(Choices):
loan_in_progress = _("loan in progress")
return_in_progress = _("return in progress")
to_find = _("to find")
sent = _("sent")
buyout = _("buyout")


class OfficeInfrastructure(
Expand Down
3 changes: 1 addition & 2 deletions src/ralph/data_importer/management/commands/demodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def generate_data_center(self):
def generate_back_office(self):
self.stdout.write('Generating Back Office assets')
back_office_status = BackOfficeAssetStatus()
status_count = len(back_office_status)
per_page = self.object_limit / status_count
per_page = 2
parent_category = CategoryFactory(
name='BACK OFFICE',
imei_required=False
Expand Down
2 changes: 1 addition & 1 deletion src/ralph/data_importer/tests/test_demo_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class DemoDataTestCase(TestCase):
def test_demo_data_command(self):
management.call_command('demodata')
self.assertEqual(DataCenterAsset.objects.count(), 422)
self.assertEqual(BackOfficeAsset.objects.count(), 240)
self.assertEqual(BackOfficeAsset.objects.count(), 248)
self.assertEqual(get_user_model().objects.count(), 33)