Display and edit project code for purchase orders

This commit is contained in:
Oliver Walters 2023-04-21 21:05:03 +10:00
parent 340c3ba766
commit 8d1f6161fa
6 changed files with 44 additions and 1 deletions

View file

@ -335,7 +335,7 @@ class InvenTreePart extends InvenTreeModel {
double get building => getDouble("building");
// Get the number of BOMs this Part is used in (if it is a component)
int get usedInCount => getInt("used_in");
int get usedInCount => jsondata.containsKey("used_in") ? getInt("used_in", backup: 0) : 0;
bool get isAssembly => getBool("assembly");

View file

@ -23,4 +23,6 @@ class InvenTreeProjectCode extends InvenTreeModel {
"description": {},
};
}
String get code => getString("code");
}

View file

@ -34,6 +34,7 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
},
"supplier_reference": {},
"description": {},
"project_code": {},
"target_date": {},
"link": {},
"responsible": {},
@ -77,6 +78,15 @@ class InvenTreePurchaseOrder extends InvenTreeModel {
int get supplierId => getInt("supplier");
// Project code information
int get projectCodeId => getInt("project_code");
String get projectCode => getString("code", subKey: "project_code_detail");
String get projectCodeDescription => getString("description", subKey: "project_code_detail");
bool get hasProjectCode => projectCode.isNotEmpty;
InvenTreeCompany? get supplier {
dynamic supplier_detail = jsondata["supplier_detail"];