2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-07-11 08:04:14 +00:00

StockItem Updates (#550)
Some checks failed
Android / build (push) Has been cancelled
CI / test (push) Has been cancelled
iOS / build (push) Has been cancelled

* bump version

* Add new helpers for StockItem

* Navigate to sales order from stock item

* Navigate to customer (if specified)

* linting fix
This commit is contained in:
Oliver
2024-11-20 16:47:04 +11:00
committed by GitHub
parent 1a1521efe3
commit 20e454d287
5 changed files with 155 additions and 28 deletions

View File

@ -291,7 +291,9 @@ class InvenTreeStockItem extends InvenTreeModel {
}
int get status => getInt("status");
bool get isInStock => getBool("in_stock", backup: true);
String get packaging => getString("packaging");
String get batch => getString("batch");
@ -321,27 +323,35 @@ class InvenTreeStockItem extends InvenTreeModel {
bool get isBuilding => getBool("is_building");
// Date of last update
DateTime? get updatedDate {
if (jsondata.containsKey("updated")) {
return DateTime.tryParse((jsondata["updated"] ?? "") as String);
} else {
return null;
}
}
int get salesOrderId => getInt("sales_order");
String get updatedDateString {
var _updated = updatedDate;
bool get hasSalesOrder => salesOrderId > 0;
if (_updated == null) {
return "";
}
int get customerId => getInt("customer");
final DateFormat _format = DateFormat("yyyy-MM-dd");
bool get hasCustomer => customerId > 0;
return _format.format(_updated);
// Date of last update
DateTime? get updatedDate {
if (jsondata.containsKey("updated")) {
return DateTime.tryParse((jsondata["updated"] ?? "") as String);
} else {
return null;
}
}
String get updatedDateString {
var _updated = updatedDate;
if (_updated == null) {
return "";
}
final DateFormat _format = DateFormat("yyyy-MM-dd");
return _format.format(_updated);
}
DateTime? get stocktakeDate {
if (jsondata.containsKey("stocktake_date")) {
return DateTime.tryParse((jsondata["stocktake_date"] ?? "") as String);