fix(shift-closing): count partial-invoice payments in reconciliation#300
Open
NotAbdelrahmanelsayed wants to merge 1 commit into
Conversation
Payments collected against an existing partially-paid / due Sales Invoice were recorded as Payment Entries with reference_no = "POS-<invoice>", while POS shift closing looks up payments by reference_no = <opening shift name>. As a result those payments (e.g. 500 cash on a due invoice) never appeared in the closing-shift reconciliation and the cashier saw a short cash drawer. Thread the active opening shift from the POS UI down to the Payment Entry so it is tagged with the shift name and found during reconciliation: - add_payment_to_partial_invoice / create_payment_entry accept an optional pos_opening_shift and use it as reference_no when no explicit reference_no is supplied (invoice-name fallback preserved otherwise). - InvoiceManagement.vue and PartialPayments.vue pass the current shift (useShift) when submitting a payment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a cashier collects a payment against an existing partially-paid / due Sales Invoice (e.g. 500 cash on an invoice with an outstanding balance), the amount is recorded correctly as a Payment Entry — but it does not show up in the Close Shift reconciliation. The cashier ends up with a cash drawer that looks short by exactly the amount collected on due invoices.
Root cause
A
reference_nomismatch between how the payment is created and how shift closing queries it:reference_nowritten<opening shift name>(e.g.POSA-OS-24-0000001)POS-<invoice name>(fallback)get_payments_entries()inpos_closing_shift.pyfiltersWHERE reference_no = <opening shift name>, so partial-invoice payments are never matched.Fix
Thread the active opening shift from the POS UI down to the Payment Entry, so it is tagged with the shift name and discovered during reconciliation.
Backend —
pos_next/api/partial_payments.pycreate_payment_entry()andadd_payment_to_partial_invoice()accept an optionalpos_opening_shift.reference_nois supplied, the shift name is used asreference_no. ThePOS-<invoice>fallback is preserved for non-shift contexts.Frontend
InvoiceManagement.vueandPartialPayments.vuepass the current shift (useShift().currentShift?.name) when submitting a payment.Result
Cash (and any mode of payment) collected on due/partial invoices during a shift now appears in the Close Shift reconciliation totals.
Scope
3 files, +16/−1. Backward compatible —
pos_opening_shiftis optional.