diff --git a/client/src/components/parts-order-modal/parts-order-modal.container.jsx b/client/src/components/parts-order-modal/parts-order-modal.container.jsx index b909209f5..1d68645be 100644 --- a/client/src/components/parts-order-modal/parts-order-modal.container.jsx +++ b/client/src/components/parts-order-modal/parts-order-modal.container.jsx @@ -89,7 +89,8 @@ export function PartsOrderModalContainer({ return { ...p, - job_line_id: jobLineId + job_line_id: jobLineId, + ...(isReturn && { cm_received: false }) }; }); diff --git a/client/src/graphql/parts-orders.queries.js b/client/src/graphql/parts-orders.queries.js index 264e7d7a5..b3de911a2 100644 --- a/client/src/graphql/parts-orders.queries.js +++ b/client/src/graphql/parts-orders.queries.js @@ -356,7 +356,10 @@ export const MUTATION_BACKORDER_PART_LINE = gql` export const QUERY_UNRECEIVED_LINES = gql` query QUERY_UNRECEIVED_LINES($jobId: uuid!, $vendorId: uuid!) { parts_order_lines( - where: { parts_order: { jobid: { _eq: $jobId }, vendorid: { _eq: $vendorId } }, cm_received: { _neq: true } } + where: { + parts_order: { jobid: { _eq: $jobId }, vendorid: { _eq: $vendorId }, return: { _eq: true } } + _or: [{ cm_received: { _neq: true } }, { cm_received: { _is_null: true } }] + } ) { cm_received id