Skip to content

Commit 752fb97

Browse files
Transfer stock location (inventree#5117)
* Hide info messages if no data * pre-fill location when transferring stock * Change iteration variable * Measure twice, cut once * js improvements
1 parent a78b26f commit 752fb97

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

InvenTree/part/tasks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ def rebuild_parameters(template_id):
459459
parameter.save()
460460
n += 1
461461

462-
logger.info(f"Rebuilt {n} parameters for template '{template.name}'")
462+
if n > 0:
463+
logger.info(f"Rebuilt {n} parameters for template '{template.name}'")
463464

464465

465466
def rebuild_supplier_parts(part_id):
@@ -486,4 +487,5 @@ def rebuild_supplier_parts(part_id):
486487
except ValidationError:
487488
pass
488489

489-
logger.info(f"Rebuilt {n} supplier parts for part '{prt.name}'")
490+
if n > 0:
491+
logger.info(f"Rebuilt {n} supplier parts for part '{prt.name}'")

InvenTree/templates/js/translated/stock.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,26 @@ function adjustStock(action, items, options={}) {
11481148
var extraFields = {};
11491149

11501150
if (specifyLocation) {
1151+
1152+
// If a common location is specified, use that as the default
1153+
let commonLocation = null;
1154+
1155+
for (const item of items) {
1156+
1157+
if (item.location == commonLocation) {
1158+
continue;
1159+
}
1160+
1161+
if (commonLocation == null) {
1162+
commonLocation = item.location;
1163+
} else {
1164+
commonLocation = null;
1165+
break;
1166+
}
1167+
}
1168+
11511169
extraFields.location = {
1170+
value: commonLocation,
11521171
filters: {
11531172
structural: false,
11541173
},

0 commit comments

Comments
 (0)