2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-16 12:15:31 +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 157 additions and 30 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,26 +323,34 @@ 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");
bool get hasSalesOrder => salesOrderId > 0;
int get customerId => getInt("customer");
bool get hasCustomer => customerId > 0;
// 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 "";
}
String get updatedDateString {
var _updated = updatedDate;
final DateFormat _format = DateFormat("yyyy-MM-dd");
if (_updated == null) {
return "";
}
final DateFormat _format = DateFormat("yyyy-MM-dd");
return _format.format(_updated);
}
return _format.format(_updated);
}
DateTime? get stocktakeDate {
if (jsondata.containsKey("stocktake_date")) {