           E.reconciliation.editReconciliationModal(@reconciliationModal)
 
     editReconciliationModal: (modal) ->
-      displayedItemIds = $('.nested-item-form[data-item-id]').map(-> $(this).attr('data-item-id')).toArray()
+      displayedItemIds = $('.nested-fields .nested-item-form[data-item-id]').map(-> $(this).attr('data-item-id')).toArray()
 
       for id in displayedItemIds
         $checkbox = modal.getModalContent().find("input[type='checkbox'][data-id=#{id}]")

      $('.reconcile-state').addClass('hidden')

  refresh_state = ->
    $displayComplianceStates = $(".nested-item-form[data-non-compliant='true']")

    set_reconciliation_state !!$('.nested-item-form[data-item-id]').length

    if !$displayComplianceStates.length
      $('.compliance-title').addClass('hidden')
    else
      $('.compliance-title').removeClass('hidden')

  $(document).on 'cocoon:after-remove', '#new_reception, #new_purchase_invoice', refresh_state


  $(document).on 'change', '#purchase_invoice_accepted_state', (event) ->

  $(document).on 'click', '#purchase_process_reconciliation .valid-modal', (event) ->
    modal = $(event.target).closest('#purchase_process_reconciliation')

    displayedItemIds = $('.nested-fields .nested-item-form[data-item-id]').map(-> $(this).attr('data-item-id')).toArray()

    if $(this).attr('data-item-reconciliation') != undefined
      # Reconciliation on line
