Skip to content

fix(shift-closing): count partial-invoice payments in reconciliation#300

Open
NotAbdelrahmanelsayed wants to merge 1 commit into
BrainWise-DEV:developfrom
NotAbdelrahmanelsayed:feat/partial-payments-shift-reconciliation
Open

fix(shift-closing): count partial-invoice payments in reconciliation#300
NotAbdelrahmanelsayed wants to merge 1 commit into
BrainWise-DEV:developfrom
NotAbdelrahmanelsayed:feat/partial-payments-shift-reconciliation

Conversation

@NotAbdelrahmanelsayed

Copy link
Copy Markdown
Contributor

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_no mismatch between how the payment is created and how shift closing queries it:

reference_no written
Normal POS invoice payment <opening shift name> (e.g. POSA-OS-24-0000001)
Partial / due invoice payment POS-<invoice name> (fallback)

get_payments_entries() in pos_closing_shift.py filters WHERE 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.py

  • create_payment_entry() and add_payment_to_partial_invoice() accept an optional pos_opening_shift.
  • When no explicit reference_no is supplied, the shift name is used as reference_no. The POS-<invoice> fallback is preserved for non-shift contexts.

Frontend

  • InvoiceManagement.vue and PartialPayments.vue pass 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_shift is optional.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant