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

7. After you can check back the Credit note is apply in which invoice in Credit Note page.