> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vinmake.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Order

> Update a sales order (creates a new version).

All fields are optional - only provided fields will be updated.

**Actions:**
- `draft`: Keep as draft
- `submit_for_review`: Submit for approval
- `approve`: Approve order (Manager/Admin only)
- `confirm`: Confirm order (legacy alias for approve)
- `reject`: Reject order (Manager/Admin only)
- `mark_in_procurement`: Mark as in procurement
- `mark_in_production`: Mark as in production
- `mark_delivered`: Mark as delivered



## OpenAPI

````yaml /api/openapi-cutmake.json patch /api/v1/orders/{document_id}
openapi: 3.1.0
info:
  title: VM App API
  version: 0.1.0
servers:
  - url: https://vinmake-erp.onrender.com
security: []
paths:
  /api/v1/orders/{document_id}:
    patch:
      tags:
        - Sales Orders
      summary: Update Order
      description: |-
        Update a sales order (creates a new version).

        All fields are optional - only provided fields will be updated.

        **Actions:**
        - `draft`: Keep as draft
        - `submit_for_review`: Submit for approval
        - `approve`: Approve order (Manager/Admin only)
        - `confirm`: Confirm order (legacy alias for approve)
        - `reject`: Reject order (Manager/Admin only)
        - `mark_in_procurement`: Mark as in procurement
        - `mark_in_production`: Mark as in production
        - `mark_delivered`: Mark as delivered
      operationId: update_order_api_v1_orders__document_id__patch
      parameters:
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            title: Document Id
        - name: X-User-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-User-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SalesOrderUpdateInput'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesOrderUpdateResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    SalesOrderUpdateInput:
      properties:
        action:
          anyOf:
            - $ref: '#/components/schemas/SalesOrderAction'
            - type: 'null'
        clientId:
          anyOf:
            - type: string
            - type: 'null'
          title: Clientid
        clientPoNumber:
          anyOf:
            - type: string
              maxLength: 50
            - type: 'null'
          title: Clientponumber
        styleId:
          anyOf:
            - type: string
            - type: 'null'
          title: Styleid
        etd:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Etd
        shippingTerm:
          anyOf:
            - type: string
            - type: 'null'
          title: Shippingterm
        deadline:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Deadline
        shipmentPlan:
          anyOf:
            - type: string
            - type: 'null'
          title: Shipmentplan
        shipmentSchedule:
          anyOf:
            - items:
                $ref: '#/components/schemas/SalesOrderShipmentScheduleInput'
              type: array
            - type: 'null'
          title: Shipmentschedule
        paymentTerm:
          anyOf:
            - type: string
            - type: 'null'
          title: Paymentterm
        estimatedQuantity:
          anyOf:
            - type: integer
            - type: 'null'
          title: Estimatedquantity
        estimatedCost:
          anyOf:
            - type: number
            - type: 'null'
          title: Estimatedcost
        sourceQuoteId:
          anyOf:
            - type: string
            - type: 'null'
          title: Sourcequoteid
        trueCostPrice:
          anyOf:
            - type: number
            - type: 'null'
          title: Truecostprice
        trueCostCurrency:
          anyOf:
            - type: string
            - type: 'null'
          title: Truecostcurrency
        budgetAllowableTolerance:
          anyOf:
            - type: number
            - type: 'null'
          title: Budgetallowabletolerance
        requestedDeliveryDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Requesteddeliverydate
        requestedBulkReadyDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Requestedbulkreadydate
        notes:
          anyOf:
            - type: string
            - type: 'null'
          title: Notes
        lineItems:
          anyOf:
            - items:
                $ref: '#/components/schemas/SalesOrderLineItemInput'
              type: array
            - type: 'null'
          title: Lineitems
        changeDescription:
          anyOf:
            - type: string
            - type: 'null'
          title: Changedescription
      type: object
      title: SalesOrderUpdateInput
      description: |-
        Input schema for updating a sales order (PATCH /orders/{id}).
        All fields are optional - only provided fields will be updated.

        Use 'action' to trigger state transitions.
    SalesOrderUpdateResponse:
      properties:
        success:
          type: boolean
          title: Success
        message:
          type: string
          title: Message
        salesOrderId:
          type: string
          title: Salesorderid
        documentId:
          type: string
          title: Documentid
        versionNumber:
          type: integer
          title: Versionnumber
        status:
          type: string
          title: Status
      type: object
      required:
        - success
        - message
        - salesOrderId
        - documentId
        - versionNumber
        - status
      title: SalesOrderUpdateResponse
      description: Response after updating a sales order
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SalesOrderAction:
      type: string
      enum:
        - draft
        - submit_for_review
        - approve
        - confirm
        - reject
        - mark_in_procurement
        - mark_in_production
        - mark_partially_delivered
        - mark_delivered
      title: SalesOrderAction
      description: >-
        Actions for sales order state transitions


        Permissions:

        - draft, submit_for_review: Any authenticated user

        - confirm, reject: Manager or Admin only

        - mark_in_procurement, mark_in_production, mark_delivered: Manager or
        Admin only
    SalesOrderShipmentScheduleInput:
      properties:
        shipmentNumber:
          type: integer
          minimum: 1
          title: Shipmentnumber
        etd:
          type: string
          format: date-time
          title: Etd
        quantity:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Quantity
      type: object
      required:
        - shipmentNumber
        - etd
      title: SalesOrderShipmentScheduleInput
      description: Planned shipment row for one sales order shipment.
    SalesOrderLineItemInput:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        styleSkuId:
          type: string
          title: Styleskuid
        orderQuantity:
          type: integer
          title: Orderquantity
        clientTolerance:
          type: number
          title: Clienttolerance
          default: 0
        requestedDeliveryDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Requesteddeliverydate
        requestedBulkReadyDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Requestedbulkreadydate
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
      type: object
      required:
        - styleSkuId
        - orderQuantity
      title: SalesOrderLineItemInput
      description: Sales order line item for form input
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: /auth/login

````