Uploaded image for project: 'mod-invoice'
  1. mod-invoice
  2. MODINVOICE-258

Invoice <> order relationship not cleaned up when invoice is deleted.

    XMLWordPrintable

Details

    • ACQ Sprint 117
    • 2
    • Thunderjet
    • R2 2021 Bugfix

    Description

      Overview: When an invoice is created and linked to a POL a relationship is establish and user can no longer delete the POL. However, after deleting the invoice the user still cannot delete the POL because the system seems to maintain a connection

      Steps to Reproduce:

      1. Log into some FOLIO environment as User X
      2. Create PO and POL
      3. Create invoice and invoice line for that POL
      4. Delete the invoice and invoice line
      5. Navigate to the POL
      6. Click Delete POL
      7. Confirm action

      Expected Results: POL is deleted successfully

      Actual Results: POL can not be deleted because there is a link to an invoice. However, there is no way to remove the link so the order can never be deleted. Unless someone removes the link from the database.

      Approach
      Update logic org.folio.rest.impl.InvoiceHelper#deleteInvoice
      1. Check if relation exist org.folio.services.order.OrderService#getOrderInvoiceRelationship
      2. Delete relation org.folio.services.order.OrderService#deleteOrderInvoiceRelationship(java.lang.String, org.folio.rest.core.models.RequestContext)

      Additional Information:
      Error thrown*;* update or delete on table “purchase_order” violates foreign key constraint “purchaseorderid_purchase_order_fkey” on table “order_invoice_relationship”: Key (id)=(87ed562f-f6b7-4e54-83cd-28e6bda51c2a) is still referenced from table “order_invoice_relationship”

      Acceptance criteria:
      Update permissions in the descriptors/ModuleDescriptor-template.json
      Update logic
      Unit tests
      Karate Api tests

      URL:
      Interested parties: Brannon 

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                dennisbridges Dennis Bridges
                dennisbridges Dennis Bridges
                Dennis Bridges Dennis Bridges
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases