From 3efd7f7777362a3d3d8e42eb3e0e42880a364d9c Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 11 Jul 2021 20:56:29 +1000 Subject: [PATCH] Add a "notes" field --- InvenTree/templates/js/forms.js | 9 +++++---- InvenTree/templates/js/stock.js | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/InvenTree/templates/js/forms.js b/InvenTree/templates/js/forms.js index f0807bda28..d68ce64c45 100644 --- a/InvenTree/templates/js/forms.js +++ b/InvenTree/templates/js/forms.js @@ -395,10 +395,11 @@ function constructFormBody(fields, options) { for (var name in displayed_fields) { - // Only push names which are actually in the set of fields - if (name in fields) { - field_names.push(name); - } else { + field_names.push(name); + + // 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.`); } } diff --git a/InvenTree/templates/js/stock.js b/InvenTree/templates/js/stock.js index a2be9b4fc0..e78e06c0ff 100644 --- a/InvenTree/templates/js/stock.js +++ b/InvenTree/templates/js/stock.js @@ -162,6 +162,13 @@ function adjustStock(items, options={}) { }); constructFormBody({}, { + fields: { + note: { + label: '{% trans "Notes" %}', + help_text: '{% trans "Stock transaction notes" %}', + type: 'string', + } + }, preFormContent: html, confirm: true, modal: modal,