[20.0][MIG] account_payment_mode: Migration to 20.0 #1635
access_account_payment_method_manager Let's avoid rewritting odoo registry.
_test_user_groups = (
"account.group_account_manager",
"base.group_partner_manager",
"base.group_multi_company",
)
doesn't understand that he is changing the bank_bic
on the underlying res.partner.bank object -->
<field name="bank_bic" position="attributes">
don't delete the view
"street": "38 rue Sergent Michel Berthet",
"zip": "69009",
"city": "Lyon",
useful for SEPA
<field name="city">Charleroi</field>
<field name="street">38 rue Sergent Michel Berthet</field>
<field name="zip">69009</field>
<field name="city">Lyon</field>
<field name="street">1 avenue du Roi Fabien 1er</field>
<field name="zip">75008</field>
<field name="city">Paris</field>
<field name="street">115 rue de Sèvres</field>
<field name="zip">75007</field>
<field name="city">Paris</field>
No, it's better for avoiding side effects to do it the current way.
/ocabot migration account_payment_mode
The following commit authors need to sign the Contributor License Agreement:
bert.vangroenendael@dynapps.be
clement@cotyl.net
<!-- CLA BOT SIGNING COMMENT DO NOT EDIT -->
Done, renamed to access_account_payment_method_manager so we no longer override account's own access_account_payment_method record.
Done, view restored. As bank_id no longer exists on the journal form in 20.0, it now sets the related bank_bic as readonly.
Done, address restored on the res.partner.bank (these fields now live there since res.bank was removed).
Done, address restored on the demo res.partner.bank records.
Done, address restored on the demo res.partner.bank records.
Done, address restored on the demo res.partner.bank records.
Done, address restored on the demo res.partner.bank records.
@JasminSForgeFlow @JordiBForgeFlow @miquelalzanillas @MiquelRForgeFlow @yvaucher @rafaelbn @xaviedoanhduy @BertVGroenendael @pausanchezqubiq @misern2 Can you check if you can sign the CLA with this old emails
@alexis-via there is one mail that could be an old one for you. can you check? If you don't have access to it, we can pre-mark it if necessary
Can you check if you can sign the CLA with this old emails
I don't see the point of it, nor if it's feasible. In my opinion, @oca-cla-bot should only check the CLA for the commits in these different cases:
I will look into the bot checker code and see if I can amend it.
I will look into the bot checker code and see if I can amend it.
FYI, done in https://github.com/OCA/clabot/pull/3.
The CLA is a license grant from whoever holds the rights to the contribution.
Committer changes for reasons unrelated to authorship.
So, no, I think we should keep it as it is.
I don't have access to that old email anymore. And I'm pretty sure I signed the CLA a long time ago with it.
Is it because I changed my login email on odoo-community.org a while ago? Did we change something on that CI check?
expr="//page[@id='other_tab']//field[@name='partner_bank_id'][@invisible="move_type != 'out_invoice'"]"
In Odoo 20, core defines partner_bank_id twice in other_tab (out_invoice and out_refund). The current xpath matches both, but position="attributes" only applies to the first, so out_refund is silently left untouched. Making the xpath explicit (matching on invisible) avoids relying on field order in core's view, and fails loudly if core changes it.
Is there any reason to keep this? It prevents the view from being updated on module upgrade, so any future change to it would not reach existing databases. It was introduced in the 19.0 migration and looks like a leftover, since it's a view and not data. If there's no specific reason, I'd suggest removing it.
Is there any reason to override readonly on the header partner_bank_id? Core 20 uses is_move_sent and state != 'draft', and the module forces state != 'draft', which makes it stricter than core. The invisible override is also identical to core's, so it could be dropped. If the stricter readonly is intentional, fine; otherwise I'd remove both to keep the diff closer to core.
Code reviewed and tested locally.
TT64784
Functional review on Odoo 20.0 Community (nightly 20261110), l10n_de (SKR03), together with #1636, #1638 and #1647. We use this module in production on 19.0.
res.partner.bank (bank_bic, bank_name) work for us in the payment order and in the SEPA file built on top of it.I have nothing to add to the open review points above; they did not show in what we use. LGTM from the functional side.
@etobella alexis@via.ecp.fr is one of my old email addresses. This mailbox is closed, I don't have access to it anymore.
FYI, there is a small OCA module account_payment_method_base which adds the missing form/list/search views and menu entry on account.payment.method: https://github.com/OCA/account-payment/tree/20.0/account_payment_method_base
@alexis-via your mail was solved:
@yvaucher @rafaelbn @glitchov @clementthomas
Approved these changes.
Thanks! Done: account_payment_mode now depends on account_payment_method_base and its own account.payment.method views/menu were removed.
Done, suggestion applied.
No specific reason, removed both overrides so it follows core.
Agreed, it was a leftover. Removed noupdate="1".
Ey, wait, I don't want to depend on account_payment_method_base. Please don't do that.
it is not necessary to see the payment method with payment mode, so no need of the module
Sorry about that, reverted: account_payment_mode depends only on account again and keeps its own account.payment.method views/menu, as before.
I have some non-blocking questions:
account_payment_mode_company_rule is an ir.rule in 19.0 and an ir.access here. I simulated that case and -u fails with found record of different model ir.rule. I found no core migration for it. Unless OpenUpgrade covers it, shouldn't we rename the id in the CSV and add a pre-migration.py that removes the stale ir_model_data row?_test_user_groups = None, ir.access, the multi-company restriction and the _select_list override aren't exercised. Shouldn't we add a small test with an account.group_account_manager user?bank_bic readonly: bank_id is gone and core 20.0 leaves bank_bic editable. @MiquelRForgeFlow, shouldn't we drop the view to stay closer to core?, unless you still want it readonly.partner_bank_id from preferred_payment_method_line_id, and the module resets it to False when the mode doesn't require a bank account. If that's intended, shouldn't we pin it with a test?Thanks for the migration @alan196, and nice work on the pre-create columns via odoo.tools.sql in hooks.py — that avoids the MemoryError you'd otherwise hit on large databases.
Just flagging @cristina-hidalgo-tecnativa's three review comments from a couple of days ago — I think all three are legitimate and worth addressing before merge:
1. account_move_view.xml — xpath specificity (highest value fix): Cristina is right that in v20 core, partner_bank_id is defined twice in other_tab (one for out_invoice, one for out_refund), and the current xpath without a discriminator only applies position="attributes" to the first match — leaving the out_refund field silently untouched. For users who issue credit notes with alternate bank accounts (which is our case at an Italian customer), this would cause a real behavior gap. Making the xpath explicit on the invisible attribute (as she suggested) also fails loudly if core changes field order, which is a nice safety net.
2. reports/account_invoice_report_view.xml — noupdate="1" leftover: Looks like an accidental carry-over from the 19.0 migration. Since this is a view record (not data), noupdate prevents any future view change from reaching existing databases, which is almost certainly unintended. Safe to drop.
3. Header partner_bank_id readonly override: Minor consistency point — the module's readonly="state != 'draft'" is stricter than core's is_move_sent and state != 'draft', and the invisible override duplicates core. If there's no intentional UX reason for the stricter readonly, aligning with core keeps the diff minimal and easier to maintain.
Static scan on the added lines didn't flag any v20 breaking patterns (no tree, attrs=, old security CSV, ir.rule, _sql_constraints, check_access_rights, @odoo-module) and your security CSV with the multi-company rule fused in is nicely v20-style. Once Cristina's points are addressed I'd be happy to re-review.
This module is on our pipeline for an Italian customer v20 upgrade, so interested in seeing it move forward.
bm1-phillip
alan196
Migration of
account_payment_modefrom 19.0 to 20.0 (history ported with oca-port).Changes for Odoo 20.0
ir.model.access.csvand the multi-companyir.rulewere converted tosecurity/ir.access.csv; the security XML now only defines thegroup_show_account_payment_methodgroup.account.invoice.report:_select()no longer exists; thepayment_mode_idcolumn is now added through_select_list(table).res.bankwas removed from Odoo: bank data now lives directly onres.partner.bank(bank_name,bank_bic). Demo data, the invoice report template and the tests were adapted.res.partner.bank.acc_number->account_number,account.journal.bank_acc_number->bank_account_number.account.journalform inheritance (views/account_journal.xml) was dropped: thebank_idfield it made readonly no longer exists.t-escreplaced byt-out.BaseCommonnow runs every test as a lightbase.group_usertest user by default; the test classes set_test_user_groups = Noneto keep running as the environment user (same approach as Odoo's ownaccounttests).stringattributes flagged by pylint-odoo; pre-commit auto fixes in a separate commit.Tests
-i account_payment_mode --test-enable --test-tags /account_payment_modeon a fresh database with demo data: 22 tests, 0 failed, 0 errors, no ERROR/CRITICAL in the log. pre-commit clean.Dependencies
Only core modules (
account). No other OCA PR required.Assisted-by: Claude Fable 5.1