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:
@ -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:
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user