Skip to content

[16.0][FIX] pms: count bank statement payments in the folio pending amount - #443

Open
DarioLodeiros wants to merge 1 commit into
OCA:16.0from
commitsun:16.0-fix-folio-pending-bank-statement
Open

[16.0][FIX] pms: count bank statement payments in the folio pending amount#443
DarioLodeiros wants to merge 1 commit into
OCA:16.0from
commitsun:16.0-fix-folio-pending-bank-statement

Conversation

@DarioLodeiros

Copy link
Copy Markdown
Member

Problem

A guest pays their stay by bank transfer. The accountant reconciles the bank statement line straight against the customer invoice — the standard flow when no payment was registered beforehand, and the usual one in small properties. The invoice is fully paid, but the folio stays "to pay" forever: pending_amount never goes down and reception sees an outstanding balance for a booking that was collected weeks ago.

The reason is that pms.folio._compute_amount looks only at payment_ids (account.payment). It ignores statement_line_ids, even though this module defines the relation on both sides:

  • pms.folio.statement_line_ids (pms/models/pms_folio.py)
  • account.bank.statement.line.folio_ids (pms/models/account_bank_statement_line.py)

So the data is there, and the user can link the statement line to the folio, but it has no effect on the amounts.

Fix

Take the statement lines into account next to the payments, in both the single-folio and the multi-folio branches, through a small helper (_get_payment_move_lines) that keeps the existing filter: only receivable lines of posted entries.

That filter is what keeps the amount correct in the other flow too. When a statement line is reconciled against an account.payment through an outstanding account, the statement move has no receivable line — the outstanding account is an asset — so nothing is counted twice; the payment alone is counted, exactly as today.

The @api.depends is extended accordingly so the stored fields recompute when the statement line or its move changes.

How to reproduce

  1. Create a folio with a reservation and invoice it.
  2. Register the guest's transfer as a bank statement line and reconcile it directly against that invoice (no account.payment involved).
  3. Link the statement line to the folio (folio_ids).
  4. Before this patch: the folio keeps pending_amount = amount_total and payment_state = not_paid. After it: the folio is settled.

Testing

Verified on a production database of a rural property whose 19 opening bookings had been invoiced and collected by transfer before the PMS went live: with the statement lines linked, the folios were still showing 3.086 € pending. Existing behaviour for folios collected through the PMS is unchanged, since those go through account.payment as before.

pms.folio.pending_amount only looks at account.payment records, so money
collected through a bank transfer never reaches the folio: the guest pays,
the accountant reconciles the bank statement line straight against the
customer invoice, and the folio stays "to pay" forever even though the
invoice is fully paid.

This is not an exotic setup. Reconciling a statement line directly against
the invoice is the default flow when no payment is registered beforehand,
and it is how most small properties collect transfers. The module already
models the relation on both sides (pms.folio.statement_line_ids and
account.bank.statement.line.folio_ids) but never used it to compute the
amounts.

Take those statement lines into account, next to the payments, in both the
single-folio and the multi-folio branches. Only receivable lines of posted
entries are considered, exactly as for payments, so a statement line
reconciled against an account.payment through an outstanding account is not
counted twice: its own move has no receivable line, and the payment is
already counted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants