2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-11 15:34:15 +00:00

Support image uploads in the "notes" markdown fields (#4615)

* Support image uploads in the "notes" markdown fields

- Implemented using the existing EasyMDE library
- Copy / paste support
- Drag / drop support

* Remove debug message

* Updated API version

* Better UX when saving notes

* Pin PIP version (for testing)

* Bug fixes

- Fix typo
- Use correct serializer type

* Add unit testing

* Update role permissions

* Typo fix

* Update migration file

* Adds a notes mixin class to be used for refactoring

* Refactor existing models with notes to use the new mixin

* Add helper function for finding all model types with a certain mixin

* Refactor barcode plugin to use new method

* Typo fix

* Add daily task to delete old / unused notes

* Bug fix for barcode refactoring

* Add unit testing for function
This commit is contained in:
Oliver
2023-04-19 13:08:26 +10:00
committed by GitHub
parent 2623c22b7e
commit 5cd74c4190
24 changed files with 441 additions and 63 deletions

View File

@ -11,12 +11,8 @@ import json
from django.utils.translation import gettext_lazy as _
import build.models
import company.models
import order.models
import part.models
import stock.models
from InvenTree.helpers import hash_barcode
from InvenTree.helpers import getModelsWithMixin, hash_barcode
from InvenTree.models import InvenTreeBarcodeMixin
from plugin import InvenTreePlugin
from plugin.mixins import BarcodeMixin
@ -34,16 +30,7 @@ class InvenTreeInternalBarcodePlugin(BarcodeMixin, InvenTreePlugin):
def get_supported_barcode_models():
"""Returns a list of database models which support barcode functionality"""
return [
build.models.Build,
company.models.SupplierPart,
order.models.PurchaseOrder,
order.models.ReturnOrder,
order.models.SalesOrder,
part.models.Part,
stock.models.StockItem,
stock.models.StockLocation,
]
return getModelsWithMixin(InvenTreeBarcodeMixin)
def format_matched_response(self, label, model, instance):
"""Format a response for the scanned data"""