Allow different locations per product in stock (closes #124)

Kind of basic for now, a different location can be set on purchase, the filters on the stock overview page handles different locations
This commit is contained in:
Bernd Bestel
2019-03-01 20:25:01 +01:00
parent 32e878afc9
commit b89643ddb1
8 changed files with 63 additions and 10 deletions

View File

@@ -20,6 +20,7 @@
jsonData.amount = amount;
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
jsonData.price = price;
jsonData.location_id = jsonForm.location_id;
Grocy.Api.Post('stock/products/' + jsonForm.product_id + '/add', jsonData,
function(result)
@@ -65,6 +66,7 @@
toastr.success(successMessage);
$('#amount').val(0);
$('#price').val('');
$('#location_id').val('');
Grocy.Components.DateTimePicker.Clear();
Grocy.Components.ProductPicker.SetValue('');
Grocy.Components.ProductPicker.GetInputElement().focus();
@@ -99,6 +101,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
$('#price').val(productDetails.last_price);
$('#location_id').val(productDetails.product.location_id);
if (productDetails.product.allow_partial_units_in_stock == 1)
{