StockItem Updates (#550)

* 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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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")) {