u
This commit is contained in:
@@ -30,7 +30,7 @@ export function createInitialManifestDraftState(kind) {
|
||||
partyId: null,
|
||||
number: '',
|
||||
externalNumber: '',
|
||||
lines: [emptyLine()],
|
||||
lines: kind === 'order' ? [] : [emptyLine()],
|
||||
attachments: [],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -69,12 +69,19 @@ class ManifestForm extends PureComponent {
|
||||
initialDoc?.date ||
|
||||
(props.mode === 'create' ? todayInputValue() : '');
|
||||
|
||||
if (
|
||||
props.mode === 'create' &&
|
||||
this.draftAutomat &&
|
||||
!this.draftAutomat.state.date
|
||||
) {
|
||||
this.draftAutomat.setState({ date: initialDate });
|
||||
if (props.mode === 'create' && this.draftAutomat) {
|
||||
if (!this.draftAutomat.state.date) {
|
||||
this.draftAutomat.setState({ date: initialDate });
|
||||
}
|
||||
if (
|
||||
props.kind === 'order' &&
|
||||
Array.isArray(this.draftAutomat.state.lines) &&
|
||||
this.draftAutomat.state.lines.length === 1 &&
|
||||
!this.draftAutomat.state.lines[0]?.sku &&
|
||||
!this.draftAutomat.state.lines[0]?.name
|
||||
) {
|
||||
this.draftAutomat.setState({ lines: [] });
|
||||
}
|
||||
}
|
||||
|
||||
this.state = {
|
||||
@@ -86,7 +93,11 @@ class ManifestForm extends PureComponent {
|
||||
partyId: initialDoc?.partyId ?? null,
|
||||
number: initialDoc?.number || '',
|
||||
externalNumber: initialDoc?.externalNumber || '',
|
||||
lines: Array.isArray(initialDoc?.lines) ? initialDoc.lines : (props.mode === 'create' ? [emptyLine()] : []),
|
||||
lines: Array.isArray(initialDoc?.lines)
|
||||
? (props.kind === 'order' && props.mode === 'create' && initialDoc.lines.length === 1 && !initialDoc.lines[0]?.sku && !initialDoc.lines[0]?.name
|
||||
? []
|
||||
: initialDoc.lines)
|
||||
: (props.mode === 'create' && props.kind !== 'order' ? [emptyLine()] : []),
|
||||
attachments: initialDoc?.attachments || [],
|
||||
shipments: initialEdit?.shipments || [],
|
||||
payments: initialEdit?.payments || [],
|
||||
|
||||
Reference in New Issue
Block a user