2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-03-11 22:54:17 +00:00

[bug] FIx for data migration (#11329) (#11330)

* [bug] FIx for data migration

Prevent writing of default currency to database during migration or backup

* Ignore error

(cherry picked from commit 7a646946c3)

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
github-actions[bot]
2026-02-15 22:44:21 +11:00
committed by GitHub
parent eceaa68c32
commit ccf5b39bf1
2 changed files with 6 additions and 1 deletions

View File

@@ -19,6 +19,11 @@ logger = structlog.get_logger('inventree')
def currency_code_default(create: bool = True):
"""Returns the default currency code (or USD if not specified)."""
from common.settings import get_global_setting
from InvenTree.ready import isRunningBackup, isRunningMigrations
if isRunningMigrations() or isRunningBackup():
# Prevent database writes during migration or backup operations
create = False
code = ''

View File

@@ -68,7 +68,7 @@ class SampleValidatorPlugin(SettingsMixin, ValidationMixin, InvenTreePlugin):
if isinstance(instance, part.models.BomItem):
if self.get_setting('BOM_ITEM_INTEGER'):
if float(instance.quantity) != int(instance.quantity):
if float(instance.quantity) != int(instance.quantity): # noqa: RUF069
self.raise_error({
'quantity': 'Bom item quantity must be an integer'
})