mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 04:55: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: ModelType;
|
||||||
model_field?: string;
|
model_field?: string;
|
||||||
model_formatter?: (value: any) => string;
|
model_formatter?: (value: any) => string;
|
||||||
|
model_filters?: any;
|
||||||
backup_value?: string;
|
backup_value?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -234,7 +235,9 @@ function TableAnchorValue(props: Readonly<FieldProps>) {
|
|||||||
const url = apiUrl(modelDef.api_endpoint, props.field_value);
|
const url = apiUrl(modelDef.api_endpoint, props.field_value);
|
||||||
|
|
||||||
return api
|
return api
|
||||||
.get(url)
|
.get(url, {
|
||||||
|
params: props.field_data.model_filters ?? undefined
|
||||||
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
switch (response.status) {
|
switch (response.status) {
|
||||||
case 200:
|
case 200:
|
||||||
|
@ -211,6 +211,9 @@ export default function StockDetail() {
|
|||||||
type: 'link',
|
type: 'link',
|
||||||
name: 'belongs_to',
|
name: 'belongs_to',
|
||||||
label: t`Installed In`,
|
label: t`Installed In`,
|
||||||
|
model_filters: {
|
||||||
|
part_detail: true
|
||||||
|
},
|
||||||
model_formatter: (model: any) => {
|
model_formatter: (model: any) => {
|
||||||
let text = model?.part_detail?.full_name ?? model?.name;
|
let text = model?.part_detail?.full_name ?? model?.name;
|
||||||
if (model.serial && model.quantity == 1) {
|
if (model.serial && model.quantity == 1) {
|
||||||
|
Reference in New Issue
Block a user