1. First create a credit note
  2. Go to Sales Invoice / Purchase Invoice 
  3. Click to Edit the invoice you want to apply the credit note
  4. Go to the Transaction tab on the left
  5. Click the button Use a credit note
  6. Choose the Credit Note you have created from the list, and click Use to apply