Attachments refactor (#737)

* refactor attachment code into its own file

* Add getters

* Remove custom models for each type of attachment

* Refactor existing widgets

* Fix double camera open bug

* Remove dead code

* Remove unused imports

* Refactor common code

* format

* Update release notes
This commit is contained in:
Oliver 2025-11-28 23:53:10 +11:00 committed by GitHub
parent bb10117f01
commit 346b1a150f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 381 additions and 519 deletions

View file

@ -547,28 +547,3 @@ class InvenTreePartPricing extends InvenTreeModel {
double? get saleHistoryMin => getDoubleOrNull("sale_history_min");
double? get saleHistoryMax => getDoubleOrNull("sale_history_max");
}
/*
* Class representing an attachment file against a Part object
*/
class InvenTreePartAttachment extends InvenTreeAttachment {
InvenTreePartAttachment() : super();
InvenTreePartAttachment.fromJson(Map<String, dynamic> json)
: super.fromJson(json);
@override
String get REFERENCE_FIELD => "part";
@override
String get REF_MODEL_TYPE => "part";
@override
String get URL => InvenTreeAPI().supportsModernAttachments
? "attachment/"
: "part/attachment/";
@override
InvenTreeModel createFromJson(Map<String, dynamic> json) =>
InvenTreePartAttachment.fromJson(json);
}