(root)/ – Rev 36407
Rev 36406 |
Rev 36408 |
Go to most recent revision |
Last modification |
Compare with Previous |
View Log
| RSS feed
Last modification
- Rev 36407 2026-04-27 19:54:23
- Author: amit
- Log message:
- Sale-return reversal: cancellability gate, CN on approve, INV reject, ROI semantics
GstProService.isIrnCancellable(invoiceNumber): predicate extracted from
the inline 24h check used in cancelInvoiceGst, so callers outside the
service can decide branching without duplicating the rule. DC and no-IRN
cases return false — those paths use EWB cancel / credit-note issuance.
PurchaseReturnServiceImpl: split single-phase return-receive into
submitReceiptForApproval + applyReceipt. Submit persists per-item return
type on PurchaseReturnItem so apply (called inline on auto-approve, or
later from refundOrder when finance clicks Process Refund) can replay
the scan loop without the original itemReturnTypes map.
processInvoiceReturn(autoApprove=true) no longer creates a PRO. Routes
through new cancelInvoiceFully which calls gstProService.cancelInvoiceGst
(the canonical IRN-cancel path setting Order.status=INVOICE_CANCELLED)
and adds wallet credit + warehouse-stock restoration. Cancellations now
live on Order/EInvoiceDetails screens, not in the returns ledger —
matches standard ERP practice and the existing cancelInvoiceGst flow.
processInvoiceReturn(autoApprove=false) creates an INV-prefix PRO in
pending state and calls notifyFinanceApprovalPending (Finance L1+L2
emails resolved dynamically from PositionRepository).
approveInvoiceReturn now runs applyInvoiceReturnViaCreditNote — raises
local CreditNote + CreditNoteLine rows (sequential CN# from
SellerWarehouse), issues CRN at GST via generateCreditNoteIrn, restores
warehouse stock, populates ReturnOrderInfo (this path IS a customer
return without DN — ROI is the right anchor), credits wallet. Drops the
old applyInvoiceReturnEffects helper which mishandled both cancel and
return-via-CN as the same path.
rejectInvoiceReturn: new method for finance to reject pending INV PROs.
Sale stands — only stamps reject_timestamp/reject_remark. No inventory,
no wallet, no GST action, no ROI. Closes the gap where finance had
Approve as the only option on a pending INV PRO.
refundOrder gains a refund guard (PRO must exist, not refunded, not
rejected) and applyReceipt-if-needed at the top — Finance's existing
Process Refund button now drives approve+refund atomically.
PurchaseReturnOrderRepository.selectByWarehouseIdsAndDateRange: Hibernate
query for a date-range listing on /return/invoice (default last 30
days, limit 200).
@Transactional(rollbackFor=Exception.class) at class level —
ProfitMandiBusinessException is checked, so Spring's default rollback
didn't fire on guard failures, allowing partial commits. Closing that
silently broken behaviour.
LineItemImei N+1 fix: receiveDebitNoteItems / refundOrder / rejectReturn
each iterated orders calling selectByLineItemId per row. Switched to the
existing batch selectByLineItemIds(List).
Email template finance-receipt-approval-pending.vm and SQL migration
migration_imei_net_margin_modal_api.sql added (registers the
/getImeiNetMarginModal endpoint in dtr.api and grants access to the
roles that currently access /order).