mirror of
https://github.com/inventree/InvenTree.git
synced 2026-02-19 13:18:03 +00:00
[bug] FIx for data migration (#11329)
* [bug] FIx for data migration Prevent writing of default currency to database during migration or backup * Ignore error
This commit is contained in:
@@ -19,6 +19,11 @@ logger = structlog.get_logger('inventree')
|
|||||||
def currency_code_default(create: bool = True):
|
def currency_code_default(create: bool = True):
|
||||||
"""Returns the default currency code (or USD if not specified)."""
|
"""Returns the default currency code (or USD if not specified)."""
|
||||||
from common.settings import get_global_setting
|
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 = ''
|
code = ''
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class SampleValidatorPlugin(SettingsMixin, ValidationMixin, InvenTreePlugin):
|
|||||||
|
|
||||||
if isinstance(instance, part.models.BomItem):
|
if isinstance(instance, part.models.BomItem):
|
||||||
if self.get_setting('BOM_ITEM_INTEGER'):
|
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({
|
self.raise_error({
|
||||||
'quantity': 'Bom item quantity must be an integer'
|
'quantity': 'Bom item quantity must be an integer'
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user