2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 20:15:44 +00:00

Fix for "installed in" display

- Allow "details" field to be passed custom params
This commit is contained in:
Oliver Walters
2024-11-13 02:05:20 +00:00
parent 246f17113f
commit 9943384156
2 changed files with 8 additions and 2 deletions

View File

@ -67,6 +67,7 @@ type InternalLinkField = {
model: ModelType;
model_field?: string;
model_formatter?: (value: any) => string;
model_filters?: any;
backup_value?: string;
};
@ -234,7 +235,9 @@ function TableAnchorValue(props: Readonly<FieldProps>) {
const url = apiUrl(modelDef.api_endpoint, props.field_value);
return api
.get(url)
.get(url, {
params: props.field_data.model_filters ?? undefined
})
.then((response) => {
switch (response.status) {
case 200:

View File

@ -211,10 +211,13 @@ export default function StockDetail() {
type: 'link',
name: 'belongs_to',
label: t`Installed In`,
model_filters: {
part_detail: true
},
model_formatter: (model: any) => {
let text = model?.part_detail?.full_name ?? model?.name;
if (model.serial && model.quantity == 1) {
text += `# ${model.serial}`;
text += ` # ${model.serial}`;
}
return text;