Skip to content

Commit

Permalink
Updating schema codes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelglenister committed Oct 27, 2023
1 parent 6e2b126 commit 4b0b1fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions municipal_finance/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ class ItemCodeSchemaAdmin(admin.ModelAdmin):

def save_model(self, request, obj, form, change):
obj.user = request.user
super(BaseUpdateAdmin, self).save_model(request, obj, form, change)

if not change:
obj.task_id = async_task(
Expand All @@ -341,4 +340,3 @@ def save_model(self, request, obj, form, change):
batch_size=10000,
)
obj.save()

19 changes: 10 additions & 9 deletions municipal_finance/update/item_code_schema.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from .utils import (
Updater,
)


class ItemCodeSchemaUpdater(Updater):
print("Update all item codes")
schema_codes = {
"finpos": "A6",
"capital": "SA34A",
"cashflow": "A7",
"incexp": "A4",
}


def update_item_code_schema(update_obj, batch_size, **kwargs):
updater = ItemCodeSchemaUpdater(update_obj, batch_size)
updater.update()
print("__________")
print("Update all item codes")
# For each model of item code update add codes with the corresponding schema version
# It should also be possible to update item codes of a matching schema version

0 comments on commit 4b0b1fc

Please sign in to comment.