Credit Note / Product Return
Use this feature to create a credit note from an invoice, either with a physical product return or as a financial-only credit. The same rules apply in Mobile and POS Terminal; only the screen layout differs.
Where to open it
| App | Entry point |
|---|---|
| Mobile | CreditNoteList → CreditNoteDetail, or the return action from an invoice |
| POS Terminal | creditNote split-pane menu, or Open product return from invoice detail |
The list is scoped to the selected branchId and whGrpCode. It supports search, status filtering, refresh, and pagination. Has product return is enabled by default and sends isReturn=1; turn it off to include financial-only credit notes.
End-to-end return flow
- Open an invoice and start a product-return draft. The system copies invoice/customer/company/warehouse context, the responsible salesperson, and the invoice items. Existing credit notes also reload their linked invoice so that the source-item picker remains available.
- Select Reason 1. This is required before an item can be added and before the document can be saved.
- Select an item from the invoice. The source quantity, price, amount, UOM, warehouse, tax, and weight settings seed the credit-note item.
- Set the return type, returned quantity (
qtyCN), and credit amount (priceCN). The client blocks a return quantity higher than the source item quantity and a credit amount higher than the source item amount. - Save the item. The first item save creates the document as
DRAFTwhen necessary; subsequent saves refresh the document and totals. - For a physical return (
isReturn = 1), an authorized warehouse user selects a Lot/Batch under Location. The choices come directly fromGET /api/invoices/{invoiceId}?includeLot=true, specifically the matching invoice item'slotsdata. No/api/products/lotrequest is made and no current warehouse-stock availability is checked. - Selecting a Lot sends one lot record to the credit-note item:
{ lotNo, qty: qtyCN }. Therefore the recorded return quantity always follows the credit-note item, not the invoice-lot display quantity. If several invoice lines share a product code, the displayed lot quantities are combined by Lot number only for selection. - Add evidence images after the document exists, where permitted. Save or forward the document according to the role and status rules below.
- Before B1 submission, every physical-return item must have a selected Lot and at least one of warehouse checks Q1/Q2/Q3 must be checked. Temperature is recorded as document data but has no additional client-side range validation.
Lot and return rules
| Rule | Client behavior |
|---|---|
| Invoice source | Invoice detail is requested with includeLot=true. |
| Lot picker | Uses invoice.items[].lots; each lotNo is displayed as a Batch, with its invoice quantity. |
| Stock check | Not performed for this return flow. A return is not blocked because current stock is lower than qtyCN. |
| Quantity sent for a selected lot | Exactly the credit-note item qtyCN. |
| Physical return | isReturn = 1; a Lot is mandatory before B1 submission. |
| Financial-only credit | isReturn = 0; no Location/Lot requirement before B1 submission. |
| Source-item validation | qtyCN must not exceed source qty; priceCN must not exceed source amount. |
| Multiple lots | The current UI selects one Lot per credit-note item and sends one-element lots payload. |
Status and save behavior
The client displays these statuses: DRAFT, NEW, WAITINGCN, INVUPDATE, RECEIVED, APPROVED/APPROVE, CANCELED, and ERRORRECEIVED.
| Actor / action | Result or guard |
|---|---|
| Initial save of a new document | Creates DRAFT. |
| Non-warehouse save with a physical-return item | Updates to WAITINGCN. |
| Non-warehouse save without a physical-return item | Updates to NEW. |
Warehouse save from WAITINGCN | Updates to INVUPDATE. |
Warehouse save from INVUPDATE | Remains INVUPDATE. |
| Warehouse save from another status | Blocked with a prompt to wait for warehouse processing. |
| B1 submit | Calls the B1 endpoint, then updates the document to RECEIVED on success. |
| Already sent to B1 | Submission is blocked when datetimeToB1 is present. |
| Received document | Editing actions are read-only/disabled. |
Permissions
All department values below are deptCode. The B1 user-code overrides are 012142, 012570, 012544, 012051, and 012566.
| Capability | Permission and conditions |
|---|---|
| Open the Credit Note menu (Mobile/POS Terminal) | -2, 1, 2, 3, 4, 7, 8, 9, 12, 13, 16, 20, 21, 22, 23, 27, 28, 29, or the configured menu user-code override. |
| Create from the Mobile list | -2, 1, 2, 4, 7, 8, 9, 12, 16, 22, 28, 29. |
| Save document | 7, 8, 9, 12, 22, 28, 29, and status must be DRAFT, NEW, WAITINGCN, or INVUPDATE. |
| Add item | Document is not RECEIVED and current user is the document owner. |
| Edit item quantity/amount | Not RECEIVED, document owner, and 7, 12, 22, 28, 29. |
| Delete item | Not RECEIVED and document owner. |
| Select Location/Lot | Not RECEIVED, physical-return item, and 12, 22, 28 at any branch. Departments 20 and 23 also have this permission when the selected branch has isMain = false; B1 user-code overrides remain allowed. Ownership is not required. |
| Warehouse inspection fields | 8, 9, 12, 22, 28, 29; Q1/Q2/Q3 and temperature become read-only after RECEIVED. |
| Add/delete image evidence | Document already exists and is not RECEIVED. |
| Send to B1 | Document exists, is not RECEIVED, caller is 8, 9, 12, 20, 22, 23, 28, 29 or B1 user-code override, datetimeToB1 is empty, required Lots are set, and at least one of Q1/Q2/Q3 is selected when there is a physical return. |
| Delete document from the list | Never when RECEIVED, APPROVED, or APPROVE. Otherwise it is allowed to cancel departments -2, 1, 2, 4, 12, 22, 28; for DRAFT/NEW the owner may delete; for WAITINGCN/INVUPDATE deletion is allowed. Confirmation is always required. |
API map
| Operation | API/client service |
|---|---|
| List | GET /api/credit-notes via getCreditNotes, with branch/warehouse scope and optional status, search, and isReturn |
| Credit-note detail | GET /api/credit-notes/{creditNoteId} |
| Source invoice and Lots | GET /api/invoices/{invoiceId}?includeLot=true |
| Create/update header | POST/PUT /api/credit-notes |
| Create/update/delete item | /api/credit-notes/{creditNoteId}/items |
| Save selected Lot | PUT /api/credit-notes/{creditNoteId}/items/{itemId}/lots with lots: [{ lotNo, qty }] |
| Image evidence | Credit-note file upload/delete endpoints |
| B1 | Credit-note post-to-B1 endpoint, followed by a status update to RECEIVED |
Mobile and POS Terminal parity
Both clients use the same source-invoice Lots, item validation, status transitions, B1 gates, and department/user overrides. Mobile presents a stack and modals; POS Terminal presents the CreditNoteDetailForm inside the split pane. POS Terminal keeps sourceInvoiceItems when a persisted credit note is opened so that its Lot picker uses the same invoice payload.