2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

More checks

This commit is contained in:
Oliver Walters
2022-05-22 09:56:22 +10:00
parent 53b69d9623
commit b98f044204
7 changed files with 50 additions and 30 deletions

View File

@ -34,7 +34,7 @@ class InvenTreeDrawer extends StatelessWidget {
void _search() {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
_closeDrawer();
@ -51,7 +51,7 @@ class InvenTreeDrawer extends StatelessWidget {
* Upon successful scan, data are passed off to be decoded.
*/
Future <void> _scan() async {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
_closeDrawer();
scanQrCode(context);

View File

@ -71,13 +71,13 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
UserProfile? _profile;
void _scan(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
scanQrCode(context);
}
void _showParts(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null)));
}
@ -87,7 +87,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
}
void _showStarredParts(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
Navigator.push(
context,
@ -100,13 +100,13 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
}
void _showStock(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationDisplayWidget(null)));
}
void _showPurchaseOrders(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
Navigator.push(
context,
@ -118,19 +118,19 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
/*
void _showSuppliers(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().suppliers, {"is_supplier": "true"})));
}
void _showManufacturers(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().manufacturers, {"is_manufacturer": "true"})));
}
void _showCustomers(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
if (!InvenTreeAPI().checkConnection()) return;
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().customers, {"is_customer": "true"})));
}

View File

@ -247,7 +247,7 @@ class _PurchaseOrderDetailState extends RefreshableState<PurchaseOrderDetailWidg
);
*/
if (order.isPlaced && InvenTreeAPI().supportPoReceive()) {
if (order.isPlaced && InvenTreeAPI().supportsPoReceive) {
children.add(
SimpleDialogOption(
onPressed: () {

View File

@ -311,7 +311,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
Future <void> _addStockDialog() async {
// TODO: In future, deprecate support for older API
if (InvenTreeAPI().supportModernStockTransactions()) {
if (InvenTreeAPI().supportsModernStockTransactions) {
Map<String, dynamic> fields = {
"pk": {
@ -391,7 +391,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
void _removeStockDialog() {
// TODO: In future, deprecate support for the older API
if (InvenTreeAPI().supportModernStockTransactions()) {
if (InvenTreeAPI().supportsModernStockTransactions) {
Map<String, dynamic> fields = {
"pk": {
"parent": "items",
@ -463,7 +463,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
Future <void> _countStockDialog() async {
// TODO: In future, deprecate support for older API
if (InvenTreeAPI().supportModernStockTransactions()) {
if (InvenTreeAPI().supportsModernStockTransactions) {
Map<String, dynamic> fields = {
"pk": {
@ -566,7 +566,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
Future <void> _transferStockDialog(BuildContext context) async {
// TODO: In future, deprecate support for older API
if (InvenTreeAPI().supportModernStockTransactions()) {
if (InvenTreeAPI().supportsModernStockTransactions) {
Map<String, dynamic> fields = {
"pk": {