Skip to content

pos_glory_connector: track POS payment UUIDs, de-duplicate Glory transactions and expose state in UI#2

Open
Borruso wants to merge 4 commits into16.0from
codex/improve-transaction-saving-for-glory-cash-module-eae0pl
Open

pos_glory_connector: track POS payment UUIDs, de-duplicate Glory transactions and expose state in UI#2
Borruso wants to merge 4 commits into16.0from
codex/improve-transaction-saving-for-glory-cash-module-eae0pl

Conversation

@Borruso
Copy link
Copy Markdown
Owner

@Borruso Borruso commented Mar 30, 2026

Motivation

  • Correlate POS payment lines with Glory machine transactions using a persistent UUID to reliably link payments to orders and avoid duplicate transaction records.
  • Record transaction processing state and diagnostics to improve retry handling and error visibility.
  • Surface new transaction metadata in the backend views and enable searching/filtering by state and payment UUID.

Description

  • Added new fields to glory.transaction: state, pos_payment_uuid, attempt_count, last_error, and processed_at, and enforced uniqueness of pos_payment_uuid via an SQL constraint.
  • Updated generate_glory_transaction to accept pos_payment_uuid, to deduplicate/update existing transactions when the UUID is present, increment attempt_count and set state/last_error appropriately, and to record processed_at on creation/update.
  • Enhanced pos.order.create_from_ui to build a map of incoming order payloads, extract glory_payment_uuid from statement_ids, and link existing glory.transaction records to newly created pos.order records by UUID when available.
  • Improved action_set_glory_on_order to attempt linking transactions by payment UUID before falling back to matching by amount/session/operation, and simplified imports (AccessError).
  • Extended POS frontend: models.js now attaches glory_payment_uuid to paymentlines and preserves it in JSON import/export, and GloryPaymentScreen.js initializes glory_payment_uuid, populates it when missing, and forwards it in all RPC calls to try_write_glory_transaction.
  • Updated RPC signature try_write_glory_transaction to accept pos_payment_uuid, and adapted call sites accordingly.
  • Adjusted views in glory_transaction_view.xml to display state and pos_payment_uuid in forms/trees, added search filters for state, and fixed a view field naming inconsistency.

Testing

  • No automated tests were executed for this change.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c98fefe347

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

limit=1,
)
for p in pos_order.payment_ids:
payment_uuid = p.uuid
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Stop reading missing uuid on backend payment records

create_from_ui now dereferences p.uuid for every pos.payment line, but pos.payment has no uuid field in this codebase (see addons/point_of_sale/models/pos_payment.py and _payment_fields in pos_order.py, which never stores one). This raises AttributeError during order synchronization, so POS orders cannot be finalized/synced once this path runs.

Useful? React with 👍 / 👎.

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.

1 participant