[ADD] pos_payment_method_cashdro_rounding: migration to 18.0
Migrated from the 17.0 branch (4fbf328). APIs that no longer exist in 18.0:
* `order.selected_paymentline` -> `order.get_selected_paymentline()`
* `ErrorPopup` + `env.services.popup` -> `AlertDialog` + `env.services.dialog`
* `/** @odoo-module */`, implicit in `.esm.js` since 17.0
The rounding itself needed a different approach: `get_rounding_applied()` now
reads `taxTotals.order_rounding`, only computed over payments that are already
`is_done()`. The CashDro line is still `waiting` when the amount is requested,
so a literal port would always have added 0. `getDefaultAmountDueToPayIn()` is
the 18.0 equivalent: it applies `getRoundedRemaining()` honouring both
`cash_rounding` and `only_round_cash_method`, and is what core itself uses for
the default amount of a payment line.
Only `_cashdro_payment_url()` is patched now, instead of duplicating the whole
`cashdro_send_payment_request()`, so the request flow, the acknowledge, the
polling and the error handling stay in the base module. With no cash rounding
configured the patch delegates to `super` and changes nothing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
72d3cd5dce
commit
fb5b3d1f7e
3 changed files with 57 additions and 0 deletions
18
pos_payment_method_cashdro_rounding/__manifest__.py
Normal file
18
pos_payment_method_cashdro_rounding/__manifest__.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "POS CashDro Rounding",
|
||||
"version": "18.0.1.0.0",
|
||||
"summary": "Apply cash/currency rounding to CashDro payment request amount.",
|
||||
"category": "Point of Sale",
|
||||
"license": "AGPL-3",
|
||||
"author": "Criptomart",
|
||||
"depends": [
|
||||
"point_of_sale",
|
||||
"pos_payment_method_cashdro",
|
||||
],
|
||||
"assets": {
|
||||
"point_of_sale._assets_pos": [
|
||||
"pos_payment_method_cashdro_rounding/static/src/js/cashdro_rounding.esm.js",
|
||||
],
|
||||
},
|
||||
"installable": True,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue