mirror of
https://github.com/inventree/inventree-app.git
synced 2026-06-10 08:27:15 +00:00
Support "creation_date" field for StockItem (#823)
Ref: https://github.com/inventree/InvenTree/pull/12011
This commit is contained in:
@@ -361,6 +361,10 @@ class InvenTreeAPI {
|
|||||||
// Ref: https://github.com/inventree/InvenTree/pull/11963
|
// Ref: https://github.com/inventree/InvenTree/pull/11963
|
||||||
bool get supportsNewUserEndpoints => apiVersion >= 490;
|
bool get supportsNewUserEndpoints => apiVersion >= 490;
|
||||||
|
|
||||||
|
// Does the server support the "creation_date" field on the StockItem model?
|
||||||
|
// Ref: https://github.com/inventree/InvenTree/pull/12011
|
||||||
|
bool get supportsStockItemCreationDate => apiVersion >= 496;
|
||||||
|
|
||||||
// Cached list of plugins (refreshed when we connect to the server)
|
// Cached list of plugins (refreshed when we connect to the server)
|
||||||
List<InvenTreePlugin> _plugins = [];
|
List<InvenTreePlugin> _plugins = [];
|
||||||
|
|
||||||
|
|||||||
@@ -303,6 +303,11 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
|
|
||||||
String get expiryDateString => getDateString("expiry_date");
|
String get expiryDateString => getDateString("expiry_date");
|
||||||
|
|
||||||
|
// Creation date
|
||||||
|
DateTime? get creationDate => getDate("creation_date");
|
||||||
|
|
||||||
|
String get creationDateString => getDateString("creation_date");
|
||||||
|
|
||||||
// Date of last update
|
// Date of last update
|
||||||
DateTime? get updatedDate => getDate("updated");
|
DateTime? get updatedDate => getDate("updated");
|
||||||
|
|
||||||
|
|||||||
@@ -732,6 +732,17 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (api.supportsStockItemCreationDate &&
|
||||||
|
widget.item.creationDateString.isNotEmpty) {
|
||||||
|
tiles.add(
|
||||||
|
ListTile(
|
||||||
|
title: Text(L10().creationDate),
|
||||||
|
trailing: LargeText(widget.item.creationDateString),
|
||||||
|
leading: Icon(TablerIcons.calendar_plus),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Last update?
|
// Last update?
|
||||||
if (widget.item.updatedDateString.isNotEmpty) {
|
if (widget.item.updatedDateString.isNotEmpty) {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
|
|||||||
@@ -50,15 +50,24 @@ class _PaginatedStockItemListState
|
|||||||
String get prefix => "stock_";
|
String get prefix => "stock_";
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, String> get orderingOptions => {
|
Map<String, String> get orderingOptions {
|
||||||
"part__name": L10().name,
|
Map<String, String> options = {
|
||||||
"part__IPN": L10().internalPartNumber,
|
"part__name": L10().name,
|
||||||
"stock": L10().quantity,
|
"part__IPN": L10().internalPartNumber,
|
||||||
"status": L10().status,
|
"stock": L10().quantity,
|
||||||
"batch": L10().batchCode,
|
"status": L10().status,
|
||||||
"updated": L10().lastUpdated,
|
"batch": L10().batchCode,
|
||||||
"stocktake_date": L10().lastStocktake,
|
"creation_date": L10().creationDate,
|
||||||
};
|
"updated": L10().lastUpdated,
|
||||||
|
"stocktake_date": L10().lastStocktake,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!InvenTreeAPI().supportsStockItemCreationDate) {
|
||||||
|
options.remove("creation_date");
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, Map<String, dynamic>> get filterOptions {
|
Map<String, Map<String, dynamic>> get filterOptions {
|
||||||
|
|||||||
Reference in New Issue
Block a user