From 8f45307547dfbae4db6ca791aaea6e83e2d3c74c Mon Sep 17 00:00:00 2001 From: Shoaib Sarwar Date: Fri, 4 Oct 2024 20:54:34 +0500 Subject: [PATCH 1/8] [ISSUE-3690] Add company alerts to AT tickets tasks --- djautotask/__init__.py | 2 +- djautotask/admin.py | 5 +++ djautotask/api.py | 3 ++ djautotask/management/commands/atsync.py | 5 +++ ...0118_companyalerts_companyalerttrackers.py | 38 +++++++++++++++++++ djautotask/models.py | 20 +++++++++- djautotask/sync.py | 28 ++++++++++++++ 7 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 djautotask/migrations/0118_companyalerts_companyalerttrackers.py diff --git a/djautotask/__init__.py b/djautotask/__init__.py index 3ffb321..a9788a3 100644 --- a/djautotask/__init__.py +++ b/djautotask/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -VERSION = (1, 6, 3, 'final') +VERSION = (1, 6, 4, 'final') # pragma: no cover if VERSION[-1] != "final": diff --git a/djautotask/admin.py b/djautotask/admin.py index a8f737d..c9b950e 100644 --- a/djautotask/admin.py +++ b/djautotask/admin.py @@ -397,3 +397,8 @@ class ProjectUDFAdmin(admin.ModelAdmin): @admin.register(models.ProjectNoteType) class ProjectNoteTypeAdmin(admin.ModelAdmin): list_display = ('id', 'label') + + +@admin.register(models.CompanyAlerts) +class CompanyAlertsAdmin(admin.ModelAdmin): + list_display = ('id', 'alert_text', 'alert_type', 'company') \ No newline at end of file diff --git a/djautotask/api.py b/djautotask/api.py index 76a6a2f..f99f6e0 100644 --- a/djautotask/api.py +++ b/djautotask/api.py @@ -782,6 +782,9 @@ class TicketCategoriesAPIClient(AutotaskAPIClient): API = 'TicketCategories' +class CompanyAlertAPIClient(AutotaskAPIClient): + API = 'CompanyAlerts' + class ProjectNotesAPIClient(AutotaskAPIClient): API = 'ProjectNotes' diff --git a/djautotask/management/commands/atsync.py b/djautotask/management/commands/atsync.py index ee05945..ccbfbe9 100644 --- a/djautotask/management/commands/atsync.py +++ b/djautotask/management/commands/atsync.py @@ -121,6 +121,11 @@ def __init__(self, *args, **kwargs): sync.ServiceCallTicketResourceSynchronizer, _('Service Call Ticket Resource') ), + ( + 'company_alert', + sync.CompanyAlertSynchronizer, + _('Company Alert') + ), ( 'service_call_task_resource', sync.ServiceCallTaskResourceSynchronizer, diff --git a/djautotask/migrations/0118_companyalerts_companyalerttrackers.py b/djautotask/migrations/0118_companyalerts_companyalerttrackers.py new file mode 100644 index 0000000..3aad6c8 --- /dev/null +++ b/djautotask/migrations/0118_companyalerts_companyalerttrackers.py @@ -0,0 +1,38 @@ +# Generated by Django 4.2.16 on 2024-10-04 19:27 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('djautotask', '0117_alter_tasknote_task_alter_ticketnote_ticket'), + ] + + operations = [ + migrations.CreateModel( + name='CompanyAlerts', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('alert_text', models.TextField(blank=True, max_length=8000, null=True)), + ('alert_type', models.IntegerField(blank=True, null=True)), + ('account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='alerts', to='djautotask.account')), + ], + options={ + 'db_table': 'djautotask_companyalert', + }, + ), + migrations.CreateModel( + name='CompanyAlertTrackers', + fields=[ + ], + options={ + 'db_table': 'djautotask_companyalert', + 'proxy': True, + 'indexes': [], + 'constraints': [], + }, + bases=('djautotask.companyalerts',), + ), + ] diff --git a/djautotask/models.py b/djautotask/models.py index f9ab43f..4aa7dea 100644 --- a/djautotask/models.py +++ b/djautotask/models.py @@ -1125,6 +1125,17 @@ def __str__(self): return self.name +class CompanyAlerts(models.Model): + alert_text = models.TextField(blank=True, null=True, max_length=8000) + alert_type = models.IntegerField(blank=True, null=True) + account = models.ForeignKey( + 'Account', blank=True, null=True, on_delete=models.SET_NULL, related_name='alerts' + ) + + def __str__(self): + return self.alert_text + + class TicketUDF(BaseUDF): pass @@ -1526,4 +1537,11 @@ class TaskTypeTracker(TaskType): class Meta: proxy = True - db_table = 'djautotask_tasktype' + + +class CompanyAlertTrackers(CompanyAlerts): + tracker = FieldTracker() + + class Meta: + proxy = True + db_table = 'djautotask_companyalert' \ No newline at end of file diff --git a/djautotask/sync.py b/djautotask/sync.py index efe7392..23f4424 100644 --- a/djautotask/sync.py +++ b/djautotask/sync.py @@ -1992,6 +1992,34 @@ def _assign_field_data(self, instance, json_data): return instance +class CompanyAlertSynchronizer(BatchQueryMixin, Synchronizer): + client_class = api.CompanyAlertAPIClient + model_class = models.CompanyAlertTrackers + condition_field_name = 'companyID' + last_updated_field = None + + related_meta = { + 'companyID': (models.Account, 'account'), + } + + def _assign_field_data(self, instance, object_data): + instance.id = object_data['id'] + instance.alert_text = object_data.get('alertText') + instance.alert_type = object_data.get('alertType') + instance.company_id = object_data.get('companyID') + + self.set_relations(instance, object_data) + + return instance + + @property + def active_ids(self): + active_ids = models.Account.objects.all().\ + values_list('id', flat=True).order_by(self.lookup_key) + + return active_ids + + class NoteTypeSynchronizer(PicklistSynchronizer): # Ticket note types are including task note types, and there are other # note types currently not used. e.g. project note types From 3746d4cdeed2171a36ac8083da1fdc4dc8a80833 Mon Sep 17 00:00:00 2001 From: Shoaib Sarwar Date: Mon, 7 Oct 2024 19:32:56 +0500 Subject: [PATCH 2/8] [ISSUE-3690]: Add company alerts to AT Ticket/Tasks --- djautotask/admin.py | 4 ++-- ..._tasktypetracker_table_companyalert_and_more.py} | 13 +++++++------ djautotask/models.py | 6 ++++-- djautotask/sync.py | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) rename djautotask/migrations/{0118_companyalerts_companyalerttrackers.py => 0118_alter_tasktypetracker_table_companyalert_and_more.py} (82%) diff --git a/djautotask/admin.py b/djautotask/admin.py index c9b950e..65d3945 100644 --- a/djautotask/admin.py +++ b/djautotask/admin.py @@ -399,6 +399,6 @@ class ProjectNoteTypeAdmin(admin.ModelAdmin): list_display = ('id', 'label') -@admin.register(models.CompanyAlerts) +@admin.register(models.CompanyAlert) class CompanyAlertsAdmin(admin.ModelAdmin): - list_display = ('id', 'alert_text', 'alert_type', 'company') \ No newline at end of file + list_display = ('id', 'alert_text', 'alert_type', 'account') \ No newline at end of file diff --git a/djautotask/migrations/0118_companyalerts_companyalerttrackers.py b/djautotask/migrations/0118_alter_tasktypetracker_table_companyalert_and_more.py similarity index 82% rename from djautotask/migrations/0118_companyalerts_companyalerttrackers.py rename to djautotask/migrations/0118_alter_tasktypetracker_table_companyalert_and_more.py index 3aad6c8..fe9a98a 100644 --- a/djautotask/migrations/0118_companyalerts_companyalerttrackers.py +++ b/djautotask/migrations/0118_alter_tasktypetracker_table_companyalert_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.16 on 2024-10-04 19:27 +# Generated by Django 4.2.16 on 2024-10-07 19:28 from django.db import migrations, models import django.db.models.deletion @@ -11,17 +11,18 @@ class Migration(migrations.Migration): ] operations = [ + migrations.AlterModelTable( + name='tasktypetracker', + table=None, + ), migrations.CreateModel( - name='CompanyAlerts', + name='CompanyAlert', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('alert_text', models.TextField(blank=True, max_length=8000, null=True)), ('alert_type', models.IntegerField(blank=True, null=True)), ('account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='alerts', to='djautotask.account')), ], - options={ - 'db_table': 'djautotask_companyalert', - }, ), migrations.CreateModel( name='CompanyAlertTrackers', @@ -33,6 +34,6 @@ class Migration(migrations.Migration): 'indexes': [], 'constraints': [], }, - bases=('djautotask.companyalerts',), + bases=('djautotask.companyalert',), ), ] diff --git a/djautotask/models.py b/djautotask/models.py index 4aa7dea..1ca15f6 100644 --- a/djautotask/models.py +++ b/djautotask/models.py @@ -1125,7 +1125,9 @@ def __str__(self): return self.name -class CompanyAlerts(models.Model): +class CompanyAlert(models.Model): + TICKET_EDIT_ALERT_TYPE = 3 + alert_text = models.TextField(blank=True, null=True, max_length=8000) alert_type = models.IntegerField(blank=True, null=True) account = models.ForeignKey( @@ -1539,7 +1541,7 @@ class Meta: proxy = True -class CompanyAlertTrackers(CompanyAlerts): +class CompanyAlertTrackers(CompanyAlert): tracker = FieldTracker() class Meta: diff --git a/djautotask/sync.py b/djautotask/sync.py index 23f4424..215eb56 100644 --- a/djautotask/sync.py +++ b/djautotask/sync.py @@ -2005,7 +2005,7 @@ class CompanyAlertSynchronizer(BatchQueryMixin, Synchronizer): def _assign_field_data(self, instance, object_data): instance.id = object_data['id'] instance.alert_text = object_data.get('alertText') - instance.alert_type = object_data.get('alertType') + instance.alert_type = object_data.get('alertTypeID') instance.company_id = object_data.get('companyID') self.set_relations(instance, object_data) From 73f485838d8538fca918bdcce0651a4499b6ac28 Mon Sep 17 00:00:00 2001 From: Shoaib Sarwar Date: Mon, 7 Oct 2024 19:36:17 +0500 Subject: [PATCH 3/8] fix: broken tests --- djautotask/admin.py | 2 +- djautotask/api.py | 1 + djautotask/models.py | 7 ++++--- djautotask/sync.py | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/djautotask/admin.py b/djautotask/admin.py index 65d3945..88ba7bf 100644 --- a/djautotask/admin.py +++ b/djautotask/admin.py @@ -401,4 +401,4 @@ class ProjectNoteTypeAdmin(admin.ModelAdmin): @admin.register(models.CompanyAlert) class CompanyAlertsAdmin(admin.ModelAdmin): - list_display = ('id', 'alert_text', 'alert_type', 'account') \ No newline at end of file + list_display = ('id', 'alert_text', 'alert_type', 'account') diff --git a/djautotask/api.py b/djautotask/api.py index f99f6e0..a64826c 100644 --- a/djautotask/api.py +++ b/djautotask/api.py @@ -785,6 +785,7 @@ class TicketCategoriesAPIClient(AutotaskAPIClient): class CompanyAlertAPIClient(AutotaskAPIClient): API = 'CompanyAlerts' + class ProjectNotesAPIClient(AutotaskAPIClient): API = 'ProjectNotes' diff --git a/djautotask/models.py b/djautotask/models.py index 1ca15f6..a305cdd 100644 --- a/djautotask/models.py +++ b/djautotask/models.py @@ -1131,7 +1131,8 @@ class CompanyAlert(models.Model): alert_text = models.TextField(blank=True, null=True, max_length=8000) alert_type = models.IntegerField(blank=True, null=True) account = models.ForeignKey( - 'Account', blank=True, null=True, on_delete=models.SET_NULL, related_name='alerts' + 'Account', blank=True, null=True, on_delete=models.SET_NULL, + related_name='alerts' ) def __str__(self): @@ -1539,11 +1540,11 @@ class TaskTypeTracker(TaskType): class Meta: proxy = True - + class CompanyAlertTrackers(CompanyAlert): tracker = FieldTracker() class Meta: proxy = True - db_table = 'djautotask_companyalert' \ No newline at end of file + db_table = 'djautotask_companyalert' diff --git a/djautotask/sync.py b/djautotask/sync.py index 215eb56..ddb1bc9 100644 --- a/djautotask/sync.py +++ b/djautotask/sync.py @@ -2007,7 +2007,7 @@ def _assign_field_data(self, instance, object_data): instance.alert_text = object_data.get('alertText') instance.alert_type = object_data.get('alertTypeID') instance.company_id = object_data.get('companyID') - + self.set_relations(instance, object_data) return instance From 8dd853c403e6f7584a1f3fdc42403b5c6909cb69 Mon Sep 17 00:00:00 2001 From: Shoaib Sarwar Date: Tue, 8 Oct 2024 02:34:46 +0500 Subject: [PATCH 4/8] Update: Unit tests to include CompanyAlerts Syncronizer --- ...typetracker_table_companyalert_and_more.py | 4 ++-- djautotask/models.py | 2 +- djautotask/sync.py | 3 +-- djautotask/tests/fixture_utils.py | 6 +++++ djautotask/tests/fixtures.py | 12 ++++++++++ djautotask/tests/mocks.py | 3 +++ djautotask/tests/test_commands.py | 18 +++++++++++++++ djautotask/tests/test_sync.py | 23 +++++++++++++++++++ 8 files changed, 66 insertions(+), 5 deletions(-) diff --git a/djautotask/migrations/0118_alter_tasktypetracker_table_companyalert_and_more.py b/djautotask/migrations/0118_alter_tasktypetracker_table_companyalert_and_more.py index fe9a98a..3186140 100644 --- a/djautotask/migrations/0118_alter_tasktypetracker_table_companyalert_and_more.py +++ b/djautotask/migrations/0118_alter_tasktypetracker_table_companyalert_and_more.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.16 on 2024-10-07 19:28 +# Generated by Django 4.2.16 on 2024-10-08 02:10 from django.db import migrations, models import django.db.models.deletion @@ -25,7 +25,7 @@ class Migration(migrations.Migration): ], ), migrations.CreateModel( - name='CompanyAlertTrackers', + name='CompanyAlertTracker', fields=[ ], options={ diff --git a/djautotask/models.py b/djautotask/models.py index a305cdd..198b498 100644 --- a/djautotask/models.py +++ b/djautotask/models.py @@ -1542,7 +1542,7 @@ class Meta: proxy = True -class CompanyAlertTrackers(CompanyAlert): +class CompanyAlertTracker(CompanyAlert): tracker = FieldTracker() class Meta: diff --git a/djautotask/sync.py b/djautotask/sync.py index ddb1bc9..68f5ba6 100644 --- a/djautotask/sync.py +++ b/djautotask/sync.py @@ -1994,7 +1994,7 @@ def _assign_field_data(self, instance, json_data): class CompanyAlertSynchronizer(BatchQueryMixin, Synchronizer): client_class = api.CompanyAlertAPIClient - model_class = models.CompanyAlertTrackers + model_class = models.CompanyAlertTracker condition_field_name = 'companyID' last_updated_field = None @@ -2006,7 +2006,6 @@ def _assign_field_data(self, instance, object_data): instance.id = object_data['id'] instance.alert_text = object_data.get('alertText') instance.alert_type = object_data.get('alertTypeID') - instance.company_id = object_data.get('companyID') self.set_relations(instance, object_data) diff --git a/djautotask/tests/fixture_utils.py b/djautotask/tests/fixture_utils.py index 8a39854..2627b86 100644 --- a/djautotask/tests/fixture_utils.py +++ b/djautotask/tests/fixture_utils.py @@ -376,3 +376,9 @@ def init_service_call_task_resources(): fixtures.API_SERVICE_CALL_TASK_RESOURCE) synchronizer = sync.ServiceCallTaskResourceSynchronizer() return synchronizer.sync() + +def init_company_alerts(): + models.CompanyAlert.objects.all().delete() + mocks.service_api_get_company_alerts_call(fixtures.API_COMPANY_ALERTS) + synchronizer = sync.CompanyAlertSynchronizer() + return synchronizer.sync() \ No newline at end of file diff --git a/djautotask/tests/fixtures.py b/djautotask/tests/fixtures.py index 757e686..29c4820 100644 --- a/djautotask/tests/fixtures.py +++ b/djautotask/tests/fixtures.py @@ -1434,3 +1434,15 @@ "items": API_TICKET_ITEMS, "pageDetails": API_PAGE_DETAILS } + +API_COMPANY_ALERT_ITEM = { + "id": 1, + "alertText": "Find me here: Account Detail Screen > Edit Account > Alerts tab.", + "alertTypeID": 1, + "companyID": 174 +} +API_COMPANY_ALERT_ITEMS = [API_COMPANY_ALERT_ITEM] +API_COMPANY_ALERTS = { + "items": API_COMPANY_ALERT_ITEMS, + "pageDetails": API_PAGE_DETAILS +} \ No newline at end of file diff --git a/djautotask/tests/mocks.py b/djautotask/tests/mocks.py index afb41ba..4edd5f4 100644 --- a/djautotask/tests/mocks.py +++ b/djautotask/tests/mocks.py @@ -48,6 +48,9 @@ def service_api_get_contacts_call(return_value): method_name = 'djautotask.api.ContactsAPIClient.get' return create_mock_call(method_name, return_value) +def service_api_get_company_alerts_call(return_value): + method_name = 'djautotask.api.CompanyAlertAPIClient.get' + return create_mock_call(method_name, return_value) def service_api_get_contracts_call(return_value): method_name = 'djautotask.api.ContractsAPIClient.get' diff --git a/djautotask/tests/test_commands.py b/djautotask/tests/test_commands.py index f6aafe1..cd5569c 100644 --- a/djautotask/tests/test_commands.py +++ b/djautotask/tests/test_commands.py @@ -717,6 +717,19 @@ def setUp(self): fixture_utils.init_task_predecessors() +class TestSyncCompanyAlertsCommand(AbstractBaseSyncTest, TestCase): + args = ( + mocks.service_api_get_company_alerts_call, + fixtures.API_COMPANY_ALERTS, + 'company_alert', + ) + + def setUp(self): + super().setUp() + fixture_utils.init_accounts() + fixture_utils.init_company_alerts() + + class TestSyncAllCommand(TestCase): def setUp(self): @@ -772,6 +785,7 @@ def setUp(self): TestSyncAccountLocationCommand, TestSyncTaskPredecessor, TestSyncContactCommand, + TestSyncCompanyAlertsCommand, ] self.test_args = [] @@ -853,6 +867,7 @@ def test_full_sync(self): 'service_call_task_resource': models.ServiceCallTaskResource, 'task_predecessor': models.TaskPredecessor, 'contact': models.Contact, + 'company_alert': models.CompanyAlert, } run_sync_command() pre_full_sync_counts = {} @@ -954,6 +969,8 @@ def _call_service_api(self): fixtures.API_SERVICE_CALL_TASK_RESOURCE) mocks.service_api_get_task_predecessors_call( fixtures.API_TASK_PREDECESSOR) + mocks.service_api_get_company_alerts_call( + fixtures.API_COMPANY_ALERTS) def _call_empty_service_api(self): mocks.service_api_get_ticket_udf_call(fixtures.API_EMPTY_FIELDS) @@ -1008,3 +1025,4 @@ def _call_empty_service_api(self): mocks.service_api_get_project_note_types_call( fixtures.API_EMPTY_FIELDS) mocks.service_api_get_task_picklist_call(fixtures.API_EMPTY_FIELDS) + mocks.service_api_get_company_alerts_call(fixtures.API_COMPANY_ALERTS) \ No newline at end of file diff --git a/djautotask/tests/test_sync.py b/djautotask/tests/test_sync.py index cc1066e..a3c2da3 100644 --- a/djautotask/tests/test_sync.py +++ b/djautotask/tests/test_sync.py @@ -1161,6 +1161,29 @@ def _assert_fields(self, instance, object_data): self.assertEqual(instance.account.id, object_data['companyID']) +class TestCompanyAlertsSynchronizer(SynchronizerTestMixin, TestCase): + synchronizer_class = sync.CompanyAlertSynchronizer + model_class = models.CompanyAlertTracker + fixture = fixtures.API_COMPANY_ALERTS + update_field = 'alert_text' + + def setUp(self): + super().setUp() + fixture_utils.init_accounts() + fixture_utils.init_company_alerts() + self._sync(self.fixture) + + def _call_api(self, return_data): + return mocks.service_api_get_company_alerts_call(return_data) + + def _assert_fields(self, instance, object_data): + self.assertEqual(instance.id, object_data['id']) + self.assertEqual(instance.alert_text, object_data['alertText']) + self.assertEqual(instance.alert_type, object_data['alertTypeID']) + self.assertEqual(instance.account.id, object_data['companyID']) + + + class TestServiceCallSynchronizer(SynchronizerTestMixin, TestCase): synchronizer_class = sync.ServiceCallSynchronizer model_class = models.ServiceCallTracker From 82c96568bd393275a6e0d3f41d957b8b80083476 Mon Sep 17 00:00:00 2001 From: Shoaib Sarwar Date: Thu, 10 Oct 2024 16:42:51 +0500 Subject: [PATCH 5/8] fix pep8 issues --- djautotask/models.py | 2 +- djautotask/sync.py | 2 +- djautotask/tests/fixture_utils.py | 3 ++- djautotask/tests/mocks.py | 2 ++ djautotask/tests/test_commands.py | 2 +- djautotask/tests/test_sync.py | 1 - 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/djautotask/models.py b/djautotask/models.py index 198b498..c9532f9 100644 --- a/djautotask/models.py +++ b/djautotask/models.py @@ -1131,7 +1131,7 @@ class CompanyAlert(models.Model): alert_text = models.TextField(blank=True, null=True, max_length=8000) alert_type = models.IntegerField(blank=True, null=True) account = models.ForeignKey( - 'Account', blank=True, null=True, on_delete=models.SET_NULL, + 'Account', blank=True, null=True, on_delete=models.SET_NULL, related_name='alerts' ) diff --git a/djautotask/sync.py b/djautotask/sync.py index 68f5ba6..e683e3f 100644 --- a/djautotask/sync.py +++ b/djautotask/sync.py @@ -2017,7 +2017,7 @@ def active_ids(self): values_list('id', flat=True).order_by(self.lookup_key) return active_ids - + class NoteTypeSynchronizer(PicklistSynchronizer): # Ticket note types are including task note types, and there are other diff --git a/djautotask/tests/fixture_utils.py b/djautotask/tests/fixture_utils.py index 2627b86..5a9e324 100644 --- a/djautotask/tests/fixture_utils.py +++ b/djautotask/tests/fixture_utils.py @@ -377,8 +377,9 @@ def init_service_call_task_resources(): synchronizer = sync.ServiceCallTaskResourceSynchronizer() return synchronizer.sync() + def init_company_alerts(): models.CompanyAlert.objects.all().delete() mocks.service_api_get_company_alerts_call(fixtures.API_COMPANY_ALERTS) synchronizer = sync.CompanyAlertSynchronizer() - return synchronizer.sync() \ No newline at end of file + return synchronizer.sync() diff --git a/djautotask/tests/mocks.py b/djautotask/tests/mocks.py index 4edd5f4..09bac79 100644 --- a/djautotask/tests/mocks.py +++ b/djautotask/tests/mocks.py @@ -48,10 +48,12 @@ def service_api_get_contacts_call(return_value): method_name = 'djautotask.api.ContactsAPIClient.get' return create_mock_call(method_name, return_value) + def service_api_get_company_alerts_call(return_value): method_name = 'djautotask.api.CompanyAlertAPIClient.get' return create_mock_call(method_name, return_value) + def service_api_get_contracts_call(return_value): method_name = 'djautotask.api.ContractsAPIClient.get' return create_mock_call(method_name, return_value) diff --git a/djautotask/tests/test_commands.py b/djautotask/tests/test_commands.py index cd5569c..fc16d94 100644 --- a/djautotask/tests/test_commands.py +++ b/djautotask/tests/test_commands.py @@ -1025,4 +1025,4 @@ def _call_empty_service_api(self): mocks.service_api_get_project_note_types_call( fixtures.API_EMPTY_FIELDS) mocks.service_api_get_task_picklist_call(fixtures.API_EMPTY_FIELDS) - mocks.service_api_get_company_alerts_call(fixtures.API_COMPANY_ALERTS) \ No newline at end of file + mocks.service_api_get_company_alerts_call(fixtures.API_COMPANY_ALERTS) diff --git a/djautotask/tests/test_sync.py b/djautotask/tests/test_sync.py index a3c2da3..72427e9 100644 --- a/djautotask/tests/test_sync.py +++ b/djautotask/tests/test_sync.py @@ -1183,7 +1183,6 @@ def _assert_fields(self, instance, object_data): self.assertEqual(instance.account.id, object_data['companyID']) - class TestServiceCallSynchronizer(SynchronizerTestMixin, TestCase): synchronizer_class = sync.ServiceCallSynchronizer model_class = models.ServiceCallTracker From f568852cea45489f78113a4d4403a78710d14a78 Mon Sep 17 00:00:00 2001 From: kti-sam <34463040+kti-sam@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:02:35 -0700 Subject: [PATCH 6/8] Update __init__.py --- djautotask/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djautotask/__init__.py b/djautotask/__init__.py index a9788a3..f55b3ed 100644 --- a/djautotask/__init__.py +++ b/djautotask/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -VERSION = (1, 6, 4, 'final') +VERSION = (1, 6, 6, 'final') # pragma: no cover if VERSION[-1] != "final": From 7edb1059b44a50410ef3c891d05794cd9a3f7c91 Mon Sep 17 00:00:00 2001 From: kti-sam <34463040+kti-sam@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:32:10 -0700 Subject: [PATCH 7/8] Update __init__.py --- djautotask/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/djautotask/__init__.py b/djautotask/__init__.py index f55b3ed..f648f2f 100644 --- a/djautotask/__init__.py +++ b/djautotask/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -VERSION = (1, 6, 6, 'final') +VERSION = (1, 6, 8, 'final') # pragma: no cover if VERSION[-1] != "final": From 56aea0d98eb6cd2e685dafbf1a42048686f361c4 Mon Sep 17 00:00:00 2001 From: Sam Wolfe Date: Thu, 24 Oct 2024 15:23:03 -0700 Subject: [PATCH 8/8] Added something we should have added 7 years ago --- .../migrations/0119_merge_20241024_1521.py | 14 ++++++++++++++ makemigrations.py | 18 ++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 djautotask/migrations/0119_merge_20241024_1521.py diff --git a/djautotask/migrations/0119_merge_20241024_1521.py b/djautotask/migrations/0119_merge_20241024_1521.py new file mode 100644 index 0000000..5ca01ba --- /dev/null +++ b/djautotask/migrations/0119_merge_20241024_1521.py @@ -0,0 +1,14 @@ +# Generated by Django 4.2.16 on 2024-10-24 15:21 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('djautotask', '0118_alter_tasktypetracker_table_companyalert_and_more'), + ('djautotask', '0118_alter_ticket_due_date_time'), + ] + + operations = [ + ] diff --git a/makemigrations.py b/makemigrations.py index 6139489..b957bd3 100755 --- a/makemigrations.py +++ b/makemigrations.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import django +import argparse from django.conf import settings from django.core.management import call_command @@ -12,13 +13,18 @@ ) -def makemigrations(): +def makemigrations(merge): django.setup() - # If a migration ever says to run makemigrations --merge, run this: - # call_command('makemigrations', 'djautotask', '--merge') - # (And consider adding --merge to this script.) - call_command('makemigrations', 'djautotask') + if merge: + call_command('makemigrations', 'djautotask', '--merge') + else: + call_command('makemigrations', 'djautotask') if __name__ == '__main__': - makemigrations() + parser = argparse.ArgumentParser( + description='Run makemigrations with optional --merge.') + parser.add_argument( + '--merge', action='store_true', help='Include the --merge option') + args = parser.parse_args() + makemigrations(args.merge)