-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tracking pull request to merge release-1.29.0 to master (#765)
- Loading branch information
1 parent
9cb610f
commit f7acf55
Showing
189 changed files
with
10,215 additions
and
33,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
backend/api/fixtures/operational/0032_add_credit_transaction_types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django.db import transaction | ||
|
||
from api.management.data_script import OperationalDataScript | ||
from api.models.credit_transaction_type import CreditTransactionType | ||
|
||
|
||
class AddCreditTransactionTypes(OperationalDataScript): | ||
""" | ||
Adds the agreement types | ||
""" | ||
is_revertable = False | ||
comment = 'Adds the credit transfer transaction type' | ||
|
||
def check_run_preconditions(self): | ||
return True | ||
|
||
@transaction.atomic | ||
def run(self): | ||
CreditTransactionType.objects.get_or_create( | ||
transaction_type='Credit Adjustment Validation' | ||
) | ||
CreditTransactionType.objects.get_or_create( | ||
transaction_type='Credit Adjustment Reduction' | ||
) | ||
|
||
|
||
script_class = AddCreditTransactionTypes |
101 changes: 101 additions & 0 deletions
101
backend/api/fixtures/operational/0033_add_notifications.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
from django.db import transaction | ||
|
||
from api.management.data_script import OperationalDataScript | ||
from api.models.notification import Notification | ||
from api.models.permission import Permission | ||
from api.authorities import REQUIRED_AUTHORITIES | ||
|
||
|
||
class AddNotifications(OperationalDataScript): | ||
""" | ||
Adds the Notifications | ||
""" | ||
is_revertable = False | ||
comment = 'Add the Notifications' | ||
|
||
def check_run_preconditions(self): | ||
return True | ||
|
||
def add_notifications(self): | ||
Notification.objects.get_or_create( | ||
notification_code='MODEL_YEAR_REPORT_ASSESSED_SUPPLIER', | ||
permission= Permission.objects.get(permission_code='VIEW_BCEID_NOTIFICATIONS'), | ||
defaults={ | ||
'name': 'Model Year Report Assessed by the Government of B.C.', | ||
'description': 'when government assess model year report' | ||
} | ||
) | ||
Notification.objects.get_or_create( | ||
notification_code="MODEL_YEAR_REPORT_SUBMITTED", | ||
permission= Permission.objects.get(permission_code="RECOMMEND_COMPLIANCE_REPORT"), | ||
defaults={ | ||
'name': 'Model Year Report to Review', | ||
'description': "when supplier submits the report" | ||
} | ||
) | ||
Notification.objects.get_or_create( | ||
notification_code="MODEL_YEAR_REPORT_RETURNED", | ||
permission= Permission.objects.get(permission_code="RECOMMEND_COMPLIANCE_REPORT"), | ||
defaults={ | ||
'name': 'Model Year Report Returned by the Director with Comment', | ||
'description': " when director return model year report back to analyst" | ||
} | ||
) | ||
Notification.objects.get_or_create( | ||
notification_code="MODEL_YEAR_REPORT_ASSESSED_GOVT", | ||
permission= Permission.objects.get(permission_code="RECOMMEND_COMPLIANCE_REPORT"), | ||
defaults={ | ||
'name': 'Model Year Report Issued by the Director', | ||
'description': "when director issue model year report" | ||
} | ||
) | ||
Notification.objects.get_or_create( | ||
notification_code="MODEL_YEAR_REPORT_RECOMMENDED", | ||
permission= Permission.objects.get(permission_code="SIGN_COMPLIANCE_REPORT"), | ||
defaults={ | ||
'name': 'Model Year Report to Assess', | ||
'description': "when analyst recommend model year report to the director" | ||
} | ||
) | ||
Notification.objects.get_or_create( | ||
notification_code='CREDIT_AGREEMENT_ISSUED_SUPPLIER', | ||
permission= Permission.objects.get(permission_code='VIEW_BCEID_NOTIFICATIONS'), | ||
defaults={ | ||
'name': 'Initiative or Purchase Agreement Issued by the Government of B.C.', | ||
'description': 'when government issue initiative or purchase agreement' | ||
} | ||
) | ||
Notification.objects.get_or_create( | ||
notification_code="CREDIT_AGREEMENT_RETURNED_WITH_COMMENT", | ||
permission= Permission.objects.get(permission_code="RECOMMEND_INITIATIVE_AGREEMENTS"), | ||
defaults={ | ||
'name': 'Credit Adjustment, Agreement or Penalty Returned by the Director with Comment', | ||
'description': "when director return agreement to analyst" | ||
} | ||
) | ||
Notification.objects.get_or_create( | ||
notification_code="CREDIT_AGREEMENT_ISSUED_GOVT", | ||
permission= Permission.objects.get(permission_code="RECOMMEND_INITIATIVE_AGREEMENTS"), | ||
defaults={ | ||
'name': 'Credit Adjustment, Agreement or Penalty Issued by the Director', | ||
'description': "when director issue the agreement" | ||
} | ||
) | ||
Notification.objects.get_or_create( | ||
notification_code="CREDIT_AGREEMENT_RECOMMENDED", | ||
permission= Permission.objects.get(permission_code="SIGN_INITIATIVE_AGREEMENTS"), | ||
defaults={ | ||
'name': 'Credit Adjustment, Agreement or Penalty to Issue', | ||
'description': "when analyst recommend agreement" | ||
} | ||
) | ||
|
||
|
||
@transaction.atomic | ||
def run(self): | ||
self.add_notifications() | ||
|
||
print('Added Notifications') | ||
|
||
|
||
script_class = AddNotifications |
45 changes: 45 additions & 0 deletions
45
backend/api/fixtures/operational/0034_add_create_report_permission.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from django.db import transaction | ||
|
||
from api.management.data_script import OperationalDataScript | ||
from api.models.permission import Permission | ||
from api.models.role import Role | ||
from api.models.role_permission import RolePermission | ||
from api.authorities import REQUIRED_AUTHORITIES | ||
|
||
|
||
class UpdateRolesPermissions(OperationalDataScript): | ||
""" | ||
Adds the Roles and Permissions | ||
""" | ||
is_revertable = False | ||
comment = 'Updates the permissions for the roles so that they make more ' \ | ||
'sense with application.' | ||
|
||
def check_run_preconditions(self): | ||
return True | ||
|
||
def update_analyst(self): | ||
|
||
role = Role.objects.get( | ||
role_code="ZEVA User" | ||
) | ||
|
||
permissions_to_be_added = [ | ||
'CREATE_COMPLIANCE_REPORTS', | ||
] | ||
|
||
for permission_code in permissions_to_be_added: | ||
permission = Permission.objects.get(permission_code=permission_code) | ||
RolePermission.objects.get_or_create( | ||
permission=permission, | ||
role=role | ||
) | ||
|
||
@transaction.atomic | ||
def run(self): | ||
self.update_analyst() | ||
|
||
print('Updated Permissions') | ||
|
||
|
||
script_class = UpdateRolesPermissions |
18 changes: 18 additions & 0 deletions
18
backend/api/migrations/0109_modelyearreportcomplianceobligation_from_gov.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 3.0.7 on 2021-07-04 22:27 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0108_modelyearreportcredittransaction'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='modelyearreportcomplianceobligation', | ||
name='from_gov', | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 3.1.12 on 2021-07-07 18:10 | ||
|
||
import db_comments.model_mixins | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0109_modelyearreportcomplianceobligation_from_gov'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='OrganizationDeficits', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('create_timestamp', models.DateTimeField(auto_now_add=True, null=True)), | ||
('create_user', models.CharField(default='SYSTEM', max_length=130)), | ||
('update_timestamp', models.DateTimeField(auto_now=True, null=True)), | ||
('update_user', models.CharField(max_length=130, null=True)), | ||
('credit_value', models.DecimalField(decimal_places=2, max_digits=20)), | ||
('credit_class', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='api.creditclass')), | ||
('model_year', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.modelyear')), | ||
('organization', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.organization')), | ||
], | ||
options={ | ||
'db_table': 'organization_deficits', | ||
}, | ||
bases=(models.Model, db_comments.model_mixins.DBComments), | ||
), | ||
] |
Oops, something went wrong.