We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Migration warns for phantom part changes 
Here is the warning:

```
Your models in app(s): 'part' have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
```

Running `manage.py makemigrations` does **not** generate new migration file...

Running `manage.py showmigrations part` shows all part migrations are complete.

I found this warning both with PostGreSQL and SQLite3, if that has anything to do with backend dependency.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `InvenTree/InvenTree/fields.py`
Content:
```
1 """ Custom fields used in InvenTree """
2 
3 # -*- coding: utf-8 -*-
4 from __future__ import unicode_literals
5 import sys
6 
7 from .validators import allowable_url_schemes
8 
9 from django.utils.translation import ugettext_lazy as _
10 
11 from django.forms.fields import URLField as FormURLField
12 from django.db import models as models
13 from django.core import validators
14 from django import forms
15 
16 from decimal import Decimal
17 
18 from djmoney.models.fields import MoneyField as ModelMoneyField
19 from djmoney.forms.fields import MoneyField
20 from djmoney.models.validators import MinMoneyValidator
21 
22 import InvenTree.helpers
23 
24 
25 class InvenTreeURLFormField(FormURLField):
26     """ Custom URL form field with custom scheme validators """
27 
28     default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]
29 
30 
31 class InvenTreeURLField(models.URLField):
32     """ Custom URL field which has custom scheme validators """
33 
34     default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]
35 
36     def formfield(self, **kwargs):
37         return super().formfield(**{
38             'form_class': InvenTreeURLFormField
39         })
40 
41 
42 def money_kwargs():
43     """ returns the database settings for MoneyFields """
44     from common.settings import currency_code_mappings, currency_code_default
45 
46     kwargs = {}
47     kwargs['currency_choices'] = currency_code_mappings()
48     kwargs['default_currency'] = currency_code_default()
49     return kwargs
50 
51 
52 class InvenTreeModelMoneyField(ModelMoneyField):
53     """
54     Custom MoneyField for clean migrations while using dynamic currency settings
55     """
56     
57     def __init__(self, **kwargs):
58         # detect if creating migration
59         if 'makemigrations' in sys.argv:
60             # remove currency information for a clean migration
61             kwargs['default_currency'] = ''
62             kwargs['currency_choices'] = []
63         else:
64             # set defaults
65             kwargs.update(money_kwargs())
66 
67         # Set a minimum value validator
68         validators = kwargs.get('validators', [])
69 
70         if len(validators) == 0:
71             validators.append(
72                 MinMoneyValidator(0),
73             )
74 
75         kwargs['validators'] = validators
76 
77         super().__init__(**kwargs)
78 
79     def formfield(self, **kwargs):
80         """ override form class to use own function """
81         kwargs['form_class'] = InvenTreeMoneyField
82         return super().formfield(**kwargs)
83 
84 
85 class InvenTreeMoneyField(MoneyField):
86     """ custom MoneyField for clean migrations while using dynamic currency settings """
87     def __init__(self, *args, **kwargs):
88         # override initial values with the real info from database
89         kwargs.update(money_kwargs())
90         super().__init__(*args, **kwargs)
91 
92 
93 class DatePickerFormField(forms.DateField):
94     """
95     Custom date-picker field
96     """
97 
98     def __init__(self, **kwargs):
99 
100         help_text = kwargs.get('help_text', _('Enter date'))
101         label = kwargs.get('label', None)
102         required = kwargs.get('required', False)
103         initial = kwargs.get('initial', None)
104 
105         widget = forms.DateInput(
106             attrs={
107                 'type': 'date',
108             }
109         )
110 
111         forms.DateField.__init__(
112             self,
113             required=required,
114             initial=initial,
115             help_text=help_text,
116             widget=widget,
117             label=label
118         )
119 
120 
121 def round_decimal(value, places):
122     """
123     Round value to the specified number of places.
124     """
125 
126     if value is not None:
127         # see https://docs.python.org/2/library/decimal.html#decimal.Decimal.quantize for options
128         return value.quantize(Decimal(10) ** -places)
129     return value
130 
131 
132 class RoundingDecimalFormField(forms.DecimalField):
133     def to_python(self, value):
134         value = super(RoundingDecimalFormField, self).to_python(value)
135         value = round_decimal(value, self.decimal_places)
136         return value
137 
138     def prepare_value(self, value):
139         """
140         Override the 'prepare_value' method, to remove trailing zeros when displaying.
141         Why? It looks nice!
142         """
143 
144         if type(value) == Decimal:
145             return InvenTree.helpers.normalize(value)
146         else:
147             return value
148 
149 
150 class RoundingDecimalField(models.DecimalField):
151     def to_python(self, value):
152         value = super(RoundingDecimalField, self).to_python(value)
153         return round_decimal(value, self.decimal_places)
154 
155     def formfield(self, **kwargs):
156         defaults = {
157             'form_class': RoundingDecimalFormField
158         }
159 
160         defaults.update(kwargs)
161 
162         return super().formfield(**kwargs)
163
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/InvenTree/InvenTree/fields.py b/InvenTree/InvenTree/fields.py
--- a/InvenTree/InvenTree/fields.py
+++ b/InvenTree/InvenTree/fields.py
@@ -55,7 +55,7 @@
     
     def __init__(self, **kwargs):
         # detect if creating migration
-        if 'makemigrations' in sys.argv:
+        if 'migrate' in sys.argv or 'makemigrations' in sys.argv:
             # remove currency information for a clean migration
             kwargs['default_currency'] = ''
             kwargs['currency_choices'] = []

{"golden_diff": "diff --git a/InvenTree/InvenTree/fields.py b/InvenTree/InvenTree/fields.py\n--- a/InvenTree/InvenTree/fields.py\n+++ b/InvenTree/InvenTree/fields.py\n@@ -55,7 +55,7 @@\n     \n     def __init__(self, **kwargs):\n         # detect if creating migration\n-        if 'makemigrations' in sys.argv:\n+        if 'migrate' in sys.argv or 'makemigrations' in sys.argv:\n             # remove currency information for a clean migration\n             kwargs['default_currency'] = ''\n             kwargs['currency_choices'] = []\n", "issue": "Migration warns for phantom part changes \nHere is the warning:\r\n\r\n```\r\nYour models in app(s): 'part' have changes that are not yet reflected in a migration, and so won't be applied.\r\nRun 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.\r\n```\r\n\r\nRunning `manage.py makemigrations` does **not** generate new migration file...\r\n\r\nRunning `manage.py showmigrations part` shows all part migrations are complete.\r\n\r\nI found this warning both with PostGreSQL and SQLite3, if that has anything to do with backend dependency.\n", "before_files": [{"content": "\"\"\" Custom fields used in InvenTree \"\"\"\n\n# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nimport sys\n\nfrom .validators import allowable_url_schemes\n\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom django.forms.fields import URLField as FormURLField\nfrom django.db import models as models\nfrom django.core import validators\nfrom django import forms\n\nfrom decimal import Decimal\n\nfrom djmoney.models.fields import MoneyField as ModelMoneyField\nfrom djmoney.forms.fields import MoneyField\nfrom djmoney.models.validators import MinMoneyValidator\n\nimport InvenTree.helpers\n\n\nclass InvenTreeURLFormField(FormURLField):\n    \"\"\" Custom URL form field with custom scheme validators \"\"\"\n\n    default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]\n\n\nclass InvenTreeURLField(models.URLField):\n    \"\"\" Custom URL field which has custom scheme validators \"\"\"\n\n    default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]\n\n    def formfield(self, **kwargs):\n        return super().formfield(**{\n            'form_class': InvenTreeURLFormField\n        })\n\n\ndef money_kwargs():\n    \"\"\" returns the database settings for MoneyFields \"\"\"\n    from common.settings import currency_code_mappings, currency_code_default\n\n    kwargs = {}\n    kwargs['currency_choices'] = currency_code_mappings()\n    kwargs['default_currency'] = currency_code_default()\n    return kwargs\n\n\nclass InvenTreeModelMoneyField(ModelMoneyField):\n    \"\"\"\n    Custom MoneyField for clean migrations while using dynamic currency settings\n    \"\"\"\n    \n    def __init__(self, **kwargs):\n        # detect if creating migration\n        if 'makemigrations' in sys.argv:\n            # remove currency information for a clean migration\n            kwargs['default_currency'] = ''\n            kwargs['currency_choices'] = []\n        else:\n            # set defaults\n            kwargs.update(money_kwargs())\n\n        # Set a minimum value validator\n        validators = kwargs.get('validators', [])\n\n        if len(validators) == 0:\n            validators.append(\n                MinMoneyValidator(0),\n            )\n\n        kwargs['validators'] = validators\n\n        super().__init__(**kwargs)\n\n    def formfield(self, **kwargs):\n        \"\"\" override form class to use own function \"\"\"\n        kwargs['form_class'] = InvenTreeMoneyField\n        return super().formfield(**kwargs)\n\n\nclass InvenTreeMoneyField(MoneyField):\n    \"\"\" custom MoneyField for clean migrations while using dynamic currency settings \"\"\"\n    def __init__(self, *args, **kwargs):\n        # override initial values with the real info from database\n        kwargs.update(money_kwargs())\n        super().__init__(*args, **kwargs)\n\n\nclass DatePickerFormField(forms.DateField):\n    \"\"\"\n    Custom date-picker field\n    \"\"\"\n\n    def __init__(self, **kwargs):\n\n        help_text = kwargs.get('help_text', _('Enter date'))\n        label = kwargs.get('label', None)\n        required = kwargs.get('required', False)\n        initial = kwargs.get('initial', None)\n\n        widget = forms.DateInput(\n            attrs={\n                'type': 'date',\n            }\n        )\n\n        forms.DateField.__init__(\n            self,\n            required=required,\n            initial=initial,\n            help_text=help_text,\n            widget=widget,\n            label=label\n        )\n\n\ndef round_decimal(value, places):\n    \"\"\"\n    Round value to the specified number of places.\n    \"\"\"\n\n    if value is not None:\n        # see https://docs.python.org/2/library/decimal.html#decimal.Decimal.quantize for options\n        return value.quantize(Decimal(10) ** -places)\n    return value\n\n\nclass RoundingDecimalFormField(forms.DecimalField):\n    def to_python(self, value):\n        value = super(RoundingDecimalFormField, self).to_python(value)\n        value = round_decimal(value, self.decimal_places)\n        return value\n\n    def prepare_value(self, value):\n        \"\"\"\n        Override the 'prepare_value' method, to remove trailing zeros when displaying.\n        Why? It looks nice!\n        \"\"\"\n\n        if type(value) == Decimal:\n            return InvenTree.helpers.normalize(value)\n        else:\n            return value\n\n\nclass RoundingDecimalField(models.DecimalField):\n    def to_python(self, value):\n        value = super(RoundingDecimalField, self).to_python(value)\n        return round_decimal(value, self.decimal_places)\n\n    def formfield(self, **kwargs):\n        defaults = {\n            'form_class': RoundingDecimalFormField\n        }\n\n        defaults.update(kwargs)\n\n        return super().formfield(**kwargs)\n", "path": "InvenTree/InvenTree/fields.py"}], "after_files": [{"content": "\"\"\" Custom fields used in InvenTree \"\"\"\n\n# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nimport sys\n\nfrom .validators import allowable_url_schemes\n\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom django.forms.fields import URLField as FormURLField\nfrom django.db import models as models\nfrom django.core import validators\nfrom django import forms\n\nfrom decimal import Decimal\n\nfrom djmoney.models.fields import MoneyField as ModelMoneyField\nfrom djmoney.forms.fields import MoneyField\nfrom djmoney.models.validators import MinMoneyValidator\n\nimport InvenTree.helpers\nimport common.settings\n\n\nclass InvenTreeURLFormField(FormURLField):\n    \"\"\" Custom URL form field with custom scheme validators \"\"\"\n\n    default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]\n\n\nclass InvenTreeURLField(models.URLField):\n    \"\"\" Custom URL field which has custom scheme validators \"\"\"\n\n    default_validators = [validators.URLValidator(schemes=allowable_url_schemes())]\n\n    def formfield(self, **kwargs):\n        return super().formfield(**{\n            'form_class': InvenTreeURLFormField\n        })\n\n\ndef money_kwargs():\n    \"\"\" returns the database settings for MoneyFields \"\"\"\n    kwargs = {}\n    kwargs['currency_choices'] = common.settings.currency_code_mappings()\n    kwargs['default_currency'] = common.settings.currency_code_default\n    return kwargs\n\n\nclass InvenTreeModelMoneyField(ModelMoneyField):\n    \"\"\"\n    Custom MoneyField for clean migrations while using dynamic currency settings\n    \"\"\"\n    \n    def __init__(self, **kwargs):\n        # detect if creating migration\n        if 'migrate' in sys.argv or 'makemigrations' in sys.argv:\n            # remove currency information for a clean migration\n            kwargs['default_currency'] = ''\n            kwargs['currency_choices'] = []\n        else:\n            # set defaults\n            kwargs.update(money_kwargs())\n\n        # Set a minimum value validator\n        validators = kwargs.get('validators', [])\n\n        if len(validators) == 0:\n            validators.append(\n                MinMoneyValidator(0),\n            )\n\n        kwargs['validators'] = validators\n\n        super().__init__(**kwargs)\n\n    def formfield(self, **kwargs):\n        \"\"\" override form class to use own function \"\"\"\n        kwargs['form_class'] = InvenTreeMoneyField\n        return super().formfield(**kwargs)\n\n\nclass InvenTreeMoneyField(MoneyField):\n    \"\"\" custom MoneyField for clean migrations while using dynamic currency settings \"\"\"\n    def __init__(self, *args, **kwargs):\n        # override initial values with the real info from database\n        kwargs.update(money_kwargs())\n        super().__init__(*args, **kwargs)\n\n\nclass DatePickerFormField(forms.DateField):\n    \"\"\"\n    Custom date-picker field\n    \"\"\"\n\n    def __init__(self, **kwargs):\n\n        help_text = kwargs.get('help_text', _('Enter date'))\n        label = kwargs.get('label', None)\n        required = kwargs.get('required', False)\n        initial = kwargs.get('initial', None)\n\n        widget = forms.DateInput(\n            attrs={\n                'type': 'date',\n            }\n        )\n\n        forms.DateField.__init__(\n            self,\n            required=required,\n            initial=initial,\n            help_text=help_text,\n            widget=widget,\n            label=label\n        )\n\n\ndef round_decimal(value, places):\n    \"\"\"\n    Round value to the specified number of places.\n    \"\"\"\n\n    if value is not None:\n        # see https://docs.python.org/2/library/decimal.html#decimal.Decimal.quantize for options\n        return value.quantize(Decimal(10) ** -places)\n    return value\n\n\nclass RoundingDecimalFormField(forms.DecimalField):\n    def to_python(self, value):\n        value = super(RoundingDecimalFormField, self).to_python(value)\n        value = round_decimal(value, self.decimal_places)\n        return value\n\n    def prepare_value(self, value):\n        \"\"\"\n        Override the 'prepare_value' method, to remove trailing zeros when displaying.\n        Why? It looks nice!\n        \"\"\"\n\n        if type(value) == Decimal:\n            return InvenTree.helpers.normalize(value)\n        else:\n            return value\n\n\nclass RoundingDecimalField(models.DecimalField):\n    def to_python(self, value):\n        value = super(RoundingDecimalField, self).to_python(value)\n        return round_decimal(value, self.decimal_places)\n\n    def formfield(self, **kwargs):\n        defaults = {\n            'form_class': RoundingDecimalFormField\n        }\n\n        defaults.update(kwargs)\n\n        return super().formfield(**kwargs)\n", "path": "InvenTree/InvenTree/fields.py"}]}