mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-29 22:16:47 +00:00
Create a new stock location
This commit is contained in:
parent
0d11af002b
commit
76c0ab3d7f
@ -548,6 +548,15 @@ class InvenTreeStockLocation extends InvenTreeModel {
|
||||
|
||||
String get pathstring => jsondata['pathstring'] ?? '';
|
||||
|
||||
@override
|
||||
Map<String, dynamic> formFields() {
|
||||
return {
|
||||
"name": {},
|
||||
"description": {},
|
||||
"parent": {},
|
||||
};
|
||||
}
|
||||
|
||||
String get parentpathstring {
|
||||
// TODO - Drive the refactor tractor through this
|
||||
List<String> psplit = pathstring.split('/');
|
||||
|
2
lib/l10n
2
lib/l10n
@ -1 +1 @@
|
||||
Subproject commit 0e304cc16fad68baa84204fea0b2eaf64f07c817
|
||||
Subproject commit c81c1c79d18a7304761a30adb15090017a613157
|
@ -84,16 +84,9 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
||||
return;
|
||||
}
|
||||
|
||||
launchApiForm(
|
||||
_loc.editForm(
|
||||
context,
|
||||
L10().editLocation,
|
||||
_loc.url,
|
||||
{
|
||||
"name": {},
|
||||
"description": {},
|
||||
"parent": {},
|
||||
},
|
||||
modelData: _loc.jsondata,
|
||||
onSuccess: (data) async {
|
||||
refresh();
|
||||
}
|
||||
@ -144,6 +137,31 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
Future<void> _newLocation(BuildContext context) async {
|
||||
|
||||
int pk = location?.pk ?? -1;
|
||||
|
||||
InvenTreeStockLocation().createForm(
|
||||
context,
|
||||
L10().locationCreate,
|
||||
data: {
|
||||
"parent": (pk > 0) ? pk : null,
|
||||
},
|
||||
onSuccess: (data) async {
|
||||
if (data.containsKey("pk")) {
|
||||
var loc = InvenTreeStockLocation.fromJson(data);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LocationDisplayWidget(loc)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Widget locationDescriptionCard({bool includeActions = true}) {
|
||||
if (location == null) {
|
||||
return Card(
|
||||
@ -285,6 +303,21 @@ List<Widget> detailTiles() {
|
||||
|
||||
tiles.add(locationDescriptionCard(includeActions: false));
|
||||
|
||||
if (InvenTreeAPI().checkPermission('stock', 'add')) {
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().locationCreate),
|
||||
subtitle: Text(L10().locationCreateDetail),
|
||||
leading: FaIcon(FontAwesomeIcons.sitemap, color: COLOR_CLICK),
|
||||
onTap: () async {
|
||||
_newLocation(context);
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
if (location != null) {
|
||||
// Stock adjustment actions
|
||||
if (InvenTreeAPI().checkPermission('stock', 'change')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user