mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Label printing bug fixes (#7329)
* Hide printing actions button for top level stock location * Fix typo * Add another check for null * Remove debug statement * Prevent display of multiple form-error notifications * Fix pickling for print offloading * Reset selected plugin * Exclude the entire 'context' object when pickling a printing job
This commit is contained in:
@ -15,11 +15,13 @@ import { ActionDropdown } from '../items/ActionDropdown';
|
||||
|
||||
export function PrintingActions({
|
||||
items,
|
||||
hidden,
|
||||
enableLabels,
|
||||
enableReports,
|
||||
modelType
|
||||
}: {
|
||||
items: number[];
|
||||
hidden?: boolean;
|
||||
enableLabels?: boolean;
|
||||
enableReports?: boolean;
|
||||
modelType?: ModelType;
|
||||
@ -79,8 +81,6 @@ export function PrintingActions({
|
||||
mixin: 'labels'
|
||||
},
|
||||
onValueChange: (value: string, record?: any) => {
|
||||
console.log('onValueChange:', value, record);
|
||||
|
||||
if (record?.key && record?.key != pluginKey) {
|
||||
setPluginKey(record.key);
|
||||
}
|
||||
@ -100,6 +100,7 @@ export function PrintingActions({
|
||||
},
|
||||
successMessage: t`Label printing completed successfully`,
|
||||
onFormSuccess: (response: any) => {
|
||||
setPluginKey('');
|
||||
if (!response.complete) {
|
||||
// TODO: Periodically check for completion (requires server-side changes)
|
||||
notifications.show({
|
||||
@ -164,28 +165,30 @@ export function PrintingActions({
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{reportModal.modal}
|
||||
{labelModal.modal}
|
||||
<ActionDropdown
|
||||
tooltip={t`Printing Actions`}
|
||||
icon={<IconPrinter />}
|
||||
disabled={!enabled}
|
||||
actions={[
|
||||
{
|
||||
name: t`Print Labels`,
|
||||
icon: <IconTags />,
|
||||
onClick: () => labelModal.open(),
|
||||
hidden: !enableLabels
|
||||
},
|
||||
{
|
||||
name: t`Print Reports`,
|
||||
icon: <IconReport />,
|
||||
onClick: () => reportModal.open(),
|
||||
hidden: !enableReports
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
!hidden && (
|
||||
<>
|
||||
{reportModal.modal}
|
||||
{labelModal.modal}
|
||||
<ActionDropdown
|
||||
tooltip={t`Printing Actions`}
|
||||
icon={<IconPrinter />}
|
||||
disabled={!enabled}
|
||||
actions={[
|
||||
{
|
||||
name: t`Print Labels`,
|
||||
icon: <IconTags />,
|
||||
onClick: () => labelModal.open(),
|
||||
hidden: !enableLabels
|
||||
},
|
||||
{
|
||||
name: t`Print Reports`,
|
||||
icon: <IconReport />,
|
||||
onClick: () => reportModal.open(),
|
||||
hidden: !enableReports
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -144,10 +144,12 @@ export function OptionsApiForm({
|
||||
if (error.response) {
|
||||
invalidResponse(error.response.status);
|
||||
} else {
|
||||
notifications.hide('form-error');
|
||||
notifications.show({
|
||||
title: t`Form Error`,
|
||||
message: error.message,
|
||||
color: 'red'
|
||||
color: 'red',
|
||||
id: 'form-error'
|
||||
});
|
||||
}
|
||||
return false;
|
||||
|
@ -294,6 +294,7 @@ export default function Stock() {
|
||||
<PrintingActions
|
||||
modelType={ModelType.stocklocation}
|
||||
items={[location.pk ?? 0]}
|
||||
hidden={!location?.pk}
|
||||
enableLabels
|
||||
enableReports
|
||||
/>,
|
||||
|
Reference in New Issue
Block a user