Project

General

Profile

Actions

Task #19907

open

Cancel Credit Note - Allow Reversal of Credit Note Through Debit Note

Added by Redmine Admin 3 months ago. Updated 3 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
05/19/2026
Due date:
05/19/2026 (about 3 months late)
% Done:

0%

Estimated time:
0:00 h
GitLab ID:
4439
GitLab Milestone:
GitLab Ticket Number:
1542
GitLab Time Logged:
0
Lock Timeline Date:
No
gitlab project trace:

Description

Background

Currently, MFreight does not provide a controlled way to handle cases where a user issues a Credit Note with incorrect information.

Clients have reported cases where a partial Credit Note was issued by mistake, for example:

  • Wrong amount
  • Wrong charge line

Since Credit Notes may already be fiscalised with MRA, MFreight must not delete or directly modify a fiscalised Credit Note. Instead, the system should allow the user to click Cancel Credit Note, but in the background the system must generate a Debit Note reversal using MRA document type DRN.

The original Credit Note must remain in the system with its IRN / QR Code and be marked internally as Reversed / Cancelled Internally.

The agreed approach is to allow the user to create a Debit Note to reverse the wrongly issued Credit Note. This Debit Note will also be sent to MRA for fiscalisation.

MRA-Compliant Document Flow

Original Invoice: STD

Wrong Credit Note: CRN

Reversal of Credit Note: DRN

Correct Credit Note: CRN

System flow:

Wrong Credit Note issued / fiscalised as CRN

User clicks “Cancel Credit Note”

System checks whether Refund Request has already been sent

If no Refund Request sent, system creates Debit Note reversal as DRN

Debit Note reversal is sent to MRA for fiscalisation

Original Credit Note is marked internally as Reversed / Cancelled Internally

User may create a new corrected Credit Note as CRN

Functional Requirements

1. Add “Cancel Credit Note” Action

Add a new action/button on the Credit Note listing/detail screen:

Cancel Credit Note

This action should be available only for authorised users.

Suggested placement:

  • In the existing Credit Note action buttons area
  • Near the current View / Download / Send Refund Request actions

2. Eligibility Rules

The Cancel Credit Note action should be allowed only when:

  • The Credit Note exists in the system
  • The Credit Note has not already been reversed
  • The Credit Note is linked to an invoice
  • The user has the required permission
  • No Refund Request has been sent for this Credit Note

3. Refund Request Check

The system must check the refund request status before allowing cancellation.

Rule 1 – Refund Request Not Sent

If no Refund Request has been sent:

  • System allows the user to proceed with Cancel Credit Note
  • System generates the Debit Note reversal
  • Credit Note is marked as Reversed / Cancelled Internally

Rule 2 – Refund Request Already Sent

If a Refund Request has already been sent:

  • System must block the cancellation
  • System must not generate the Debit Note reversal

Suggested message:

Credit Note cannot be cancelled because a Refund Request has already been sent.

4. User Confirmation

When user clicks Cancel Credit Note, display a confirmation popup.

Suggested message:

This action will cancel the Credit Note internally and generate a Debit Note reversal for MRA fiscalisation. Do you want to continue?

The popup should include a mandatory Cancellation Reason field.

5. Mandatory Cancellation Reason

The user must enter a reason before confirming cancellation.

Validation message:

Cancellation reason is required.

6. Generate Debit Note Reversal

When the user confirms cancellation, the system must generate a Debit Note reversal.

The Debit Note must be created as:

Document Type: DRN

The Debit Note must reverse the financial effect of the original Credit Note.

The system should populate the Debit Note using the original Credit Note details:

  • Client details
  • Original Invoice Reference
  • Original Credit Note Reference
  • Charge lines
  • Currency
  • VAT details
  • Amount
  • VAT amount
  • Total amount
  • Cancellation reason / reversal reason

Suggested DRN reason:

Reversal of Credit Note [CN Reference] issued in error

Example:

Reversal of Credit Note MACCS26CRN05112 issued in error

7. Original Credit Note Status Update

The original Credit Note must not be deleted or modified financially.

The original Credit Note should remain visible in the system and be marked internally as:

Status: Reversed / Cancelled Internally

The Credit Note should display:

  • Original CRN Reference
  • Original Invoice Reference
  • Reversed By: DRN Reference
  • Reversal Reason
  • Reversed By User
  • Reversed Date / Time

8. MRA Fiscalisation

The generated Debit Note reversal must follow the existing MRA fiscalisation process.

The document must be sent to MRA as:

Document Type: DRN

The original Credit Note remains fiscalised as:

Document Type: CRN

If the user later creates a corrected Credit Note, the corrected Credit Note must be sent as:

Document Type: CRN

9. Invoice Balance Impact

The Debit Note reversal must neutralise the effect of the original Credit Note on the invoice balance.

Example:

Original Invoice Amount: MUR 10,000

Wrong Credit Note Issued: MUR 2,000

Invoice Balance after Credit Note: MUR 8,000

Debit Note Reversal Created: MUR 2,000

Invoice Balance after Reversal: MUR 10,000

After the Debit Note reversal is created/fiscalised, the user may create a new corrected Credit Note.

10. Link Between Documents

The system must maintain a clear link between:

  • Original Invoice
  • Wrong Credit Note
  • Debit Note Reversal
  • Corrected Credit Note, if later created

Suggested display:

Original Invoice: MACCS26INV05445

Credit Note: MACCS26CRN05112

Reversed By: MACCS26DRN-xxxxx

New Credit Note: MACCS26CRNxxxxx

11. Reporting and Balance Impact

Reports and invoice balances should consider both the original Credit Note and the Debit Note reversal.

The Credit Note should remain visible for audit purposes, but its financial effect should be neutralised by the Debit Note reversal.

Cancelled / reversed Credit Notes should be clearly identifiable in:

  • Credit Note listing
  • Invoice details
  • Cost and Sales reports
  • Client statement
  • Credit Note reports
  • Fiscalisation status screen
  • any other reports

12. Permissions

Only authorised users should be allowed to cancel a Credit Note.

Unauthorised users should not see the action or should receive an access denied message.

13. Activity Log / Audit Trail

The system must log the full cancellation and reversal action.

Audit log should include:

  • Original Credit Note Reference
  • Original Invoice Reference
  • Generated Debit Note Reference
  • Document Type: DRN
  • Reversal amount
  • Reversal reason
  • User who performed the cancellation
  • Date / time
  • Refund Request status at time of cancellation
  • MRA fiscalisation status of the Debit Note

14. Debit Note PDF Generation

When the system generates a Debit Note reversal for a cancelled Credit Note, the system must also generate a Debit Note PDF.

The Debit Note PDF can follow the same layout as the existing Credit Note PDF, but the wording and document details must be changed to reflect that it is a Debit Note.

Debit Note PDF Changes

The PDF should display:

  • Document title: DEBIT NOTE
  • Debit Note Reference
  • Related Invoice Reference
  • Related Credit Note Reference being reversed
  • Client details
  • Charge details
  • Currency
  • VAT details
  • Total amount
  • Reason / remarks
  • MRA fiscalisation details
    • QR Code

PDF Wording

The Debit Note PDF should clearly indicate that it is reversing a Credit Note.

Suggested wording:

Reason:
Reversal of Credit Note [CRN Reference] issued in error

Example:

Reversal of Credit Note MACCS26CRN05112 issued in error

15. Add Status for Credit Note

Currently, the Credit Note list does not display a status for Credit Notes. Since the new process introduces cancellation/reversal, Credit Notes must now have a clear status to help users understand whether the Credit Note is active, reversed, or linked to refund request processing.

Add a Status field for Credit Notes.

The status should be visible in:

  • Credit Note list screen
  • Credit Note details/view screen
  • Reports, where applicable
  • Activity log, where applicable

Suggested Credit Note Statuses

Credit Note Status Meaning
Active Credit Note is valid and active
Reversed Credit Note has been reversed by Debit Note
Refund Request Sent Refund request has already been sent

Acceptance Criteria

AC1 – Cancel Credit Note Action Available

Given an authorised user opens the Credit Note list/detail screen
And the Credit Note is eligible for cancellation
And no Refund Request has been sent
When the user views the available actions
Then the system displays Cancel Credit Note.

AC2 – Cancel Credit Note Action Not Available / Blocked if Already Reversed

Given a Credit Note has already been reversed
When the user views the Credit Note
Then the system must not allow another cancellation/reversal for the same Credit Note.

AC3 – Refund Request Validation

Given a Refund Request has already been sent for the Credit Note
When the user attempts to cancel the Credit Note
Then the system must block the action
And display:

Credit Note cannot be cancelled because a Refund Request has already been sent.

AC4 – Reason Required

Given the user clicks Cancel Credit Note
When no cancellation reason is entered
Then the system prevents the action
And displays:

Cancellation reason is required.

AC5 – Confirmation Before Cancellation

Given the user clicks Cancel Credit Note
When the confirmation popup is displayed
Then the system must clearly inform the user that a Debit Note reversal will be generated for MRA fiscalisation.

AC6 – Debit Note Reversal Created

Given the user confirms cancellation with a valid reason
When the system processes the request
Then a Debit Note reversal is generated
And the document type is DRN.

AC7 – Debit Note Uses Credit Note Details

Given the Debit Note reversal is created
Then it should be populated using the financial details of the original Credit Note, including charges, currency, VAT, and totals.

AC8 – Original Credit Note Not Deleted

Given the Credit Note is cancelled through reversal
Then the original Credit Note must remain visible in the system
And its original fiscal data must remain unchanged.

AC9 – Original Credit Note Marked as Reversed / Cancelled Internally

Given the Debit Note reversal is generated
Then the original Credit Note status should be updated to:

Reversed / Cancelled Internally

And the Credit Note should show the related DRN reference.

AC10 – Debit Note Sent for MRA Fiscalisation

Given the Debit Note reversal is generated
When fiscalisation is triggered
Then the Debit Note should be sent to MRA as document type DRN.

AC11 – Invoice Balance Restored

Given the original Credit Note reduced the invoice balance
When the Debit Note reversal is created/fiscalised
Then the invoice balance -receipt must be restored by the reversed amount.

AC12 – Corrected Credit Note Can Be Created

Given the wrong Credit Note has been reversed by Debit Note
Then the user can create a new corrected Credit Note for the same invoice.

AC13 – Link Between Documents Maintained

Given the reversal is completed
Then the system must maintain a link between:

  • Original Invoice
  • Original Credit Note
  • Reversal Debit Note
  • Corrected Credit Note, if created later

AC14 – Activity Log Created

Given the Credit Note cancellation is completed
Then the system records the action in the activity log with all relevant details.

AC15 – Debit Note PDF Generated

Given a Credit Note is cancelled through the reversal process
When the Debit Note reversal is generated
Then the system must generate a Debit Note PDF.

AC16 – Debit Note PDF Uses Correct Title

Given the Debit Note PDF is generated
Then the PDF title must display:

DEBIT NOTE

AC17 – Debit Note PDF Shows Related Credit Note

Given the Debit Note reverses a Credit Note
Then the PDF must show the related Credit Note reference.

AC18 – Debit Note PDF Available for Download/View

Given the Debit Note reversal exists
Then the user must be able to view/download the Debit Note PDF from the Debit Note/Credit Note Retrieve screen.

AC19 – Credit Note Status Visible

Given user opens the Credit Note list
Then the system displays the Credit Note status.

AC20 – New Credit Note Defaults to Active

Given a new Credit Note is created
Then its Credit Note Status should default to:

Active

AC21 – Credit Note Status Updated After Reversal

Given a Credit Note is cancelled through Debit Note reversal
Then its status should update to:

Reversed

AC22 – Refund Request Status Considered

Given a Refund Request has been sent for a Credit Note
Then the Credit Note should clearly indicate that refund request has been sent, either through status or separate indicator.

AC23 – Status Prevents Duplicate Reversal

Given a Credit Note status is already Reversed
When user attempts to cancel it again
Then the system must block the action.

Validation Messages

Scenario Message
Missing reason Cancellation reason is required.
Refund Request already sent Credit Note cannot be cancelled because a Refund Request has already been sent.
Credit Note already reversed This Credit Note has already been reversed.
No permission You do not have permission to cancel this Credit Note.
Confirmation This action will cancel the Credit Note internally and generate a Debit Note reversal for MRA fiscalisation. Do you want to continue?

GitLab Sync Log

[]

Actions

Also available in: Atom PDF