mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-18 14:07:41 +00:00
Shipment contact info (#13016)
* Add 'contact' field to SalesOrderShipment model * add unit test * Update shipment table * improve UI form * Add 'phone' and 'email' fields to Address model * Bump API version * Update CHANGELOG * Updated docs
This commit is contained in:
1 parent
dec51eab52
commit
720ba157bb
18 files changed
+296
-8
No files matched your search
@@ -518,10 +518,26 @@ export function useSalesOrderShipmentFields({
|
||||
customerId?: number;
|
||||
pending?: boolean;
|
||||
}): ApiFormFieldSet {
|
||||
// Customer inferred from the order, if not explicitly provided
|
||||
const [orderCustomerId, setOrderCustomerId] = useState<number | undefined>(
|
||||
undefined
|
||||
);
|
||||
|
||||
const customer = customerId ?? orderCustomerId;
|
||||
|
||||
return useMemo(() => {
|
||||
return {
|
||||
order: {
|
||||
disabled: true
|
||||
disabled: true,
|
||||
onValueChange: (_value: any, record: any) => {
|
||||
// Record may be the fetched shipment, or the selected order instance
|
||||
const orderCustomer =
|
||||
record?.order_detail?.customer ?? record?.customer;
|
||||
|
||||
if (orderCustomer) {
|
||||
setOrderCustomerId(orderCustomer);
|
||||
}
|
||||
}
|
||||
},
|
||||
reference: {},
|
||||
shipment_date: {
|
||||
@@ -533,16 +549,22 @@ export function useSalesOrderShipmentFields({
|
||||
shipment_address: {
|
||||
placeholder: t`Leave blank to use the order address`,
|
||||
filters: {
|
||||
company: customerId,
|
||||
company: customer,
|
||||
ordering: '-primary'
|
||||
}
|
||||
},
|
||||
contact: {
|
||||
icon: <IconUser />,
|
||||
filters: {
|
||||
company: customer
|
||||
}
|
||||
},
|
||||
tracking_number: {},
|
||||
invoice_number: {},
|
||||
tags: TagsField({}),
|
||||
link: {}
|
||||
};
|
||||
}, [customerId, pending]);
|
||||
}, [customer, pending]);
|
||||
}
|
||||
|
||||
export function useSalesOrderShipmentCompleteFields({
|
||||
|
||||
@@ -124,6 +124,14 @@ export function SalesOrderShipmentDetailsPanel({
|
||||
) : (
|
||||
<Text size='sm' c='red'>{t`Not specified`}</Text>
|
||||
)
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
name: 'contact_detail.name',
|
||||
label: t`Contact`,
|
||||
icon: 'user',
|
||||
copy: true,
|
||||
hidden: !instance?.contact_detail?.name
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -86,6 +86,18 @@ export function AddressTable({
|
||||
sortable: false,
|
||||
switchable: true
|
||||
},
|
||||
{
|
||||
accessor: 'phone',
|
||||
sortable: false,
|
||||
switchable: true,
|
||||
defaultVisible: false
|
||||
},
|
||||
{
|
||||
accessor: 'email',
|
||||
sortable: false,
|
||||
switchable: true,
|
||||
defaultVisible: false
|
||||
},
|
||||
{
|
||||
accessor: 'shipping_notes',
|
||||
sortable: false,
|
||||
@@ -111,6 +123,8 @@ export function AddressTable({
|
||||
postal_city: {},
|
||||
province: {},
|
||||
country: {},
|
||||
phone: {},
|
||||
email: {},
|
||||
shipping_notes: {},
|
||||
internal_shipping_notes: {},
|
||||
link: {}
|
||||
|
||||
@@ -157,6 +157,12 @@ export default function SalesOrderShipmentTable({
|
||||
switchable: false,
|
||||
title: t`Items`
|
||||
},
|
||||
{
|
||||
accessor: 'contact_detail.name',
|
||||
title: t`Contact`,
|
||||
switchable: true,
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
accessor: 'checked',
|
||||
title: t`Checked`,
|
||||
|
||||
Reference in new issue
Block a user