Transfer stock location (#5117)

* Hide info messages if no data

* pre-fill location when transferring stock

* Change iteration variable

* Measure twice, cut once

* js improvements
This commit is contained in:
Oliver 2023-06-28 21:59:47 +10:00 committed by GitHub
parent a78b26f93a
commit 752fb97d2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -459,7 +459,8 @@ def rebuild_parameters(template_id):
parameter.save()
n += 1
logger.info(f"Rebuilt {n} parameters for template '{template.name}'")
if n > 0:
logger.info(f"Rebuilt {n} parameters for template '{template.name}'")
def rebuild_supplier_parts(part_id):
@ -486,4 +487,5 @@ def rebuild_supplier_parts(part_id):
except ValidationError:
pass
logger.info(f"Rebuilt {n} supplier parts for part '{prt.name}'")
if n > 0:
logger.info(f"Rebuilt {n} supplier parts for part '{prt.name}'")

View File

@ -1148,7 +1148,26 @@ function adjustStock(action, items, options={}) {
var extraFields = {};
if (specifyLocation) {
// If a common location is specified, use that as the default
let commonLocation = null;
for (const item of items) {
if (item.location == commonLocation) {
continue;
}
if (commonLocation == null) {
commonLocation = item.location;
} else {
commonLocation = null;
break;
}
}
extraFields.location = {
value: commonLocation,
filters: {
structural: false,
},