`_cashdro_payment_url()` builds the startOperation url with `this.pos.pos_session.name`. 18.0 replaced that accessor by the `session` getter of PosStore, so reading `.name` on the resulting `undefined` raises a TypeError on every single payment, before any request leaves the browser. `cashdro_send_payment_request` catches it with a bare `catch` that neither logs nor rethrows and shows the generic "error connecting to the cashdro", which is why the failure looked like a problem with the machine. `pos_payment_method_cashdro_fix` only covers the data loading, so this goes in a module of its own: it has a longer life than that temporary patch, and it supersedes its `_cashdro_url()` override. Along with the blocking one, the flow gets: * the real error logged and shown in the dialog, so a wrong host, a busy drawer and a dead network stop being the same sentence, * a missing host raised instead of the boolean `false` travelling into `fetch`, where it resolves against the Odoo server, * `finishOperation` always sent on failure, or the drawer keeps the operation open and refuses every later payment of the session, * polling on a 700ms interval with a 5 minute deadline, stopped by a cancel or by leaving the payment screen, instead of a tight unbounded loop, * `send_payment_cancel()` returning whether the drawer took it, so the line no longer sticks in `waitingCard`, * reversals sending the amount of the line negated: `get_due()` only discounts the payments already done, so the base module asked the drawer to collect the money a second time instead of dispensing it, * the `uuid` of the line honoured instead of the selected one, * the CashDro answers validated (HTTP status, JSON body, operation id). `_cashdro_amount()` is split out as the single hook for the amount, which `pos_payment_method_cashdro_rounding` uses. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
24 lines
1.3 KiB
ReStructuredText
24 lines
1.3 KiB
ReStructuredText
Split from ``pos_payment_method_cashdro_fix`` on purpose: that module is a
|
|
temporary patch for three migration leftovers, meant to disappear as soon as
|
|
its ``upstream/*.patch`` is merged in ``OCA/pos``. This one has a longer life —
|
|
only the ``pos_session`` fix is a migration leftover, the rest are problems the
|
|
module has carried since 17.0 — so it should not go away with it.
|
|
|
|
It supersedes the ``_cashdro_url()`` patch of ``pos_payment_method_cashdro_fix``
|
|
(same method, resolved from the terminal instead of the selected line, raising
|
|
instead of returning ``false``). Once the upstream patch is merged, the
|
|
dependency has to be moved to ``pos_payment_method_cashdro`` and the
|
|
``_load_pos_data_fields`` override checked, as it is the only part of the other
|
|
module this one really needs.
|
|
|
|
Still open:
|
|
|
|
* The success path leaves the operation open on the drawer, as upstream does.
|
|
Whether the CashDro3WS expects a ``finishOperation`` after a finished
|
|
operation could not be checked without a machine, so the behaviour was left
|
|
untouched.
|
|
* ``_cashdro_url()`` does not escape the user and the password, again as
|
|
upstream does: credentials containing ``&``, ``=`` or ``#`` break the query
|
|
string.
|
|
* The whole thing wants a tour with a mocked CashDro3WS endpoint, which would
|
|
also let the OCA CI catch this class of breakage.
|