mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
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:
parent
bb10117f01
commit
346b1a150f
15 changed files with 381 additions and 519 deletions
|
|
@ -334,7 +334,7 @@ class InvenTreeSalesOrderShipment extends InvenTreeModel {
|
|||
/*
|
||||
* Class representing an allocation of stock against a SalesOrderShipment
|
||||
*/
|
||||
class InvenTreeSalesOrderAllocation extends InvenTreeAttachment {
|
||||
class InvenTreeSalesOrderAllocation extends InvenTreeModel {
|
||||
InvenTreeSalesOrderAllocation() : super();
|
||||
|
||||
InvenTreeSalesOrderAllocation.fromJson(Map<String, dynamic> json)
|
||||
|
|
@ -428,48 +428,3 @@ class InvenTreeSalesOrderAllocation extends InvenTreeAttachment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class representing an attachment file against a SalesOrder object
|
||||
*/
|
||||
class InvenTreeSalesOrderAttachment extends InvenTreeAttachment {
|
||||
InvenTreeSalesOrderAttachment() : super();
|
||||
|
||||
InvenTreeSalesOrderAttachment.fromJson(Map<String, dynamic> json)
|
||||
: super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) =>
|
||||
InvenTreeSalesOrderAttachment.fromJson(json);
|
||||
|
||||
@override
|
||||
String get REFERENCE_FIELD => "order";
|
||||
|
||||
@override
|
||||
String get REF_MODEL_TYPE => "salesorder";
|
||||
|
||||
@override
|
||||
String get URL => InvenTreeAPI().supportsModernAttachments
|
||||
? "attachment/"
|
||||
: "order/so/attachment/";
|
||||
}
|
||||
|
||||
class InvenTreeSalesOrderShipmentAttachment extends InvenTreeAttachment {
|
||||
InvenTreeSalesOrderShipmentAttachment() : super();
|
||||
|
||||
InvenTreeSalesOrderShipmentAttachment.fromJson(Map<String, dynamic> json)
|
||||
: super.fromJson(json);
|
||||
|
||||
@override
|
||||
InvenTreeModel createFromJson(Map<String, dynamic> json) =>
|
||||
InvenTreeSalesOrderShipmentAttachment.fromJson(json);
|
||||
|
||||
@override
|
||||
String get REFERENCE_FIELD => "shipment";
|
||||
|
||||
@override
|
||||
String get REF_MODEL_TYPE => "salesordershipment";
|
||||
|
||||
@override
|
||||
String get URL => "attachment/";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue