Merge pull request #788 from mirumee/SALEOR-1403-cannot-fulfill-order-when-product-quantity-is-one
Fix for fulfilling order when allocated quantity equals total quantity
This commit is contained in:
commit
bf88825fcc
6 changed files with 42 additions and 11 deletions
|
@ -56,6 +56,7 @@ All notable, unreleased changes to this project will be documented in this file.
|
|||
- Fix isPublished and isAvailable behaviour for products, collections and pages - #780 by @mmarkusik
|
||||
- Add metadata editor to page views - #782 by @dominik-zeglen
|
||||
- Add missing infinite scroll to searches - #793 by @dominik-zeglen
|
||||
- Fix for fulfilling order when allocated quantity equals total quantity - #788 by @GrzegorzDerdak
|
||||
|
||||
## 2.10.1
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
|||
<TableBody>
|
||||
{renderCollection(
|
||||
order?.lines.filter(line => getRemainingQuantity(line) > 0),
|
||||
(line, lineIndex) => {
|
||||
(line: OrderFulfillData_order_lines, lineIndex) => {
|
||||
if (!line) {
|
||||
return (
|
||||
<TableRow key={lineIndex}>
|
||||
|
@ -340,9 +340,16 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
|||
);
|
||||
}
|
||||
|
||||
const warehouseAllocation = line.allocations.find(
|
||||
allocation =>
|
||||
allocation.warehouse.id === warehouse.id
|
||||
);
|
||||
const allocatedQuantityForLine =
|
||||
warehouseAllocation?.quantity || 0;
|
||||
const availableQuantity =
|
||||
warehouseStock.quantity -
|
||||
warehouseStock.quantityAllocated;
|
||||
warehouseStock.quantityAllocated +
|
||||
allocatedQuantityForLine;
|
||||
|
||||
return (
|
||||
<TableCell
|
||||
|
@ -361,7 +368,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
|||
),
|
||||
max: (
|
||||
line.variant.trackInventory &&
|
||||
warehouseStock.quantity
|
||||
availableQuantity
|
||||
).toString(),
|
||||
min: 0,
|
||||
style: { textAlign: "right" }
|
||||
|
@ -411,6 +418,7 @@ const OrderFulfillPage: React.FC<OrderFulfillPageProps> = props => {
|
|||
</TableCell>
|
||||
);
|
||||
})}
|
||||
|
||||
<TableCell
|
||||
className={classes.colQuantityTotal}
|
||||
key="total"
|
||||
|
|
|
@ -15,6 +15,7 @@ export const orderToFulfill: OrderFulfillData_order = {
|
|||
productName: "T-Shirt",
|
||||
quantity: 3,
|
||||
quantityFulfilled: 1,
|
||||
allocations: [],
|
||||
variant: {
|
||||
__typename: "ProductVariant",
|
||||
id: "UHJvZHVjdFZhcmlhbnQ6Mjk2",
|
||||
|
@ -76,6 +77,7 @@ export const orderToFulfill: OrderFulfillData_order = {
|
|||
productName: "Lemon Juice",
|
||||
quantity: 4,
|
||||
quantityFulfilled: 0,
|
||||
allocations: [],
|
||||
variant: {
|
||||
__typename: "ProductVariant",
|
||||
id: "UHJvZHVjdFZhcmlhbnQ6MTgx",
|
||||
|
@ -130,6 +132,7 @@ export const orderToFulfill: OrderFulfillData_order = {
|
|||
productName: "Orange Juice",
|
||||
quantity: 3,
|
||||
quantityFulfilled: 2,
|
||||
allocations: [],
|
||||
variant: {
|
||||
__typename: "ProductVariant",
|
||||
id: "UHJvZHVjdFZhcmlhbnQ6MTgy",
|
||||
|
|
|
@ -195,6 +195,12 @@ const orderFulfillData = gql`
|
|||
isShippingRequired
|
||||
productName
|
||||
quantity
|
||||
allocations {
|
||||
quantity
|
||||
warehouse {
|
||||
id
|
||||
}
|
||||
}
|
||||
quantityFulfilled
|
||||
variant {
|
||||
id
|
||||
|
|
|
@ -52,6 +52,7 @@ export interface OrderFulfillData_order_lines {
|
|||
productName: string;
|
||||
quantity: number;
|
||||
quantityFulfilled: number;
|
||||
allocations: OrderFulfillData_order_allocation[];
|
||||
variant: OrderFulfillData_order_lines_variant | null;
|
||||
thumbnail: OrderFulfillData_order_lines_thumbnail | null;
|
||||
}
|
||||
|
@ -70,3 +71,15 @@ export interface OrderFulfillData {
|
|||
export interface OrderFulfillDataVariables {
|
||||
orderId: string;
|
||||
}
|
||||
|
||||
export interface OrderFulfillData_order_allocation {
|
||||
__typename: "Allocation";
|
||||
id: string;
|
||||
quantity: number;
|
||||
warehouse: OrderFulfillData_order_allocation_warehouse;
|
||||
}
|
||||
|
||||
export interface OrderFulfillData_order_allocation_warehouse {
|
||||
__typename: "Warehouse";
|
||||
id: string;
|
||||
}
|
||||
|
|
|
@ -85609,7 +85609,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id OrderFulfillPage-quantityInnerInput-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
max="760"
|
||||
max="758"
|
||||
min="0"
|
||||
style="text-align:right"
|
||||
type="number"
|
||||
|
@ -85649,7 +85649,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id OrderFulfillPage-quantityInnerInput-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
max="760"
|
||||
max="727"
|
||||
min="0"
|
||||
style="text-align:right"
|
||||
type="number"
|
||||
|
@ -85689,7 +85689,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id OrderFulfillPage-quantityInnerInput-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
max="760"
|
||||
max="756"
|
||||
min="0"
|
||||
style="text-align:right"
|
||||
type="number"
|
||||
|
@ -85819,7 +85819,7 @@ exports[`Storyshots Views / Orders / Fulfill order default 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id OrderFulfillPage-quantityInnerInput-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
max="587"
|
||||
max="586"
|
||||
min="0"
|
||||
style="text-align:right"
|
||||
type="number"
|
||||
|
@ -86262,7 +86262,7 @@ exports[`Storyshots Views / Orders / Fulfill order error 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id OrderFulfillPage-quantityInnerInput-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
max="760"
|
||||
max="758"
|
||||
min="0"
|
||||
style="text-align:right"
|
||||
type="number"
|
||||
|
@ -86302,7 +86302,7 @@ exports[`Storyshots Views / Orders / Fulfill order error 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id OrderFulfillPage-quantityInnerInput-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
max="760"
|
||||
max="727"
|
||||
min="0"
|
||||
style="text-align:right"
|
||||
type="number"
|
||||
|
@ -86342,7 +86342,7 @@ exports[`Storyshots Views / Orders / Fulfill order error 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id OrderFulfillPage-quantityInnerInput-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
max="760"
|
||||
max="756"
|
||||
min="0"
|
||||
style="text-align:right"
|
||||
type="number"
|
||||
|
@ -86472,7 +86472,7 @@ exports[`Storyshots Views / Orders / Fulfill order error 1`] = `
|
|||
<input
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input-id MuiOutlinedInput-input-id OrderFulfillPage-quantityInnerInput-id MuiInputBase-inputAdornedEnd-id MuiOutlinedInput-inputAdornedEnd-id"
|
||||
max="587"
|
||||
max="586"
|
||||
min="0"
|
||||
style="text-align:right"
|
||||
type="number"
|
||||
|
|
Loading…
Reference in a new issue