Add "location" field

This commit is contained in:
Oliver 2021-07-11 21:07:56 +10:00
parent 3efd7f7777
commit 9eb1367d80
2 changed files with 9 additions and 2 deletions

View File

@ -400,7 +400,6 @@ function constructFormBody(fields, options) {
// Field not specified in the API, but the client wishes to add it!
if (!(name in fields)) {
fields[name] = displayed_fields[name];
console.log(`WARNING: '${name}' does not match a valid field name.`);
}
}

View File

@ -132,7 +132,7 @@ function adjustStock(items, options={}) {
var buttons = `<div class='btn-group float-right' role='group'>`;
buttons += makeIconButton(
'fa-trash-alt icon-red',
'fa-times icon-red',
'button-stock-item-remove',
pk,
'{% trans "Remove stock item" %}',
@ -163,6 +163,14 @@ function adjustStock(items, options={}) {
constructFormBody({}, {
fields: {
location: {
label: '{% trans "Location" %}',
help_text: '{% trans "Select stock location" %}',
type: 'related field',
required: true,
api_url: `/api/stock/location/`,
model: 'stocklocation',
},
note: {
label: '{% trans "Notes" %}',
help_text: '{% trans "Stock transaction notes" %}',