A typo in the uninstall hook of the account_payment module tries to access a non-existing field, resulting in an error during module removal. The uninstall hook was introduced by commit [1], however the bug was actually introduced by commit [2] including a rename of the field being accessed. [1]: https://github.com/odoo/odoo/commit/61b8c0c1a2be6e7966413bf3c60b4475ae0e9a94 [2]: https://github.com/odoo/odoo/commit/f7b8f07501315233c8208e99b311935815039a3a closes odoo/odoo#100907 X-original-commit: ffb7411cb800fccd9fc8dd2d9a183850bdb46347 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
27 lines
1.0 KiB
Python
27 lines
1.0 KiB
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from . import controllers
|
|
from . import models
|
|
from . import wizards
|
|
|
|
from odoo import api, SUPERUSER_ID
|
|
|
|
|
|
def post_init_hook(cr, registry):
|
|
""" Create `account.payment.method` records for the installed payment providers. """
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
PaymentProvider = env['payment.provider']
|
|
installed_providers = PaymentProvider.search([('module_id.state', '=', 'installed')])
|
|
for code in set(installed_providers.mapped('code')):
|
|
PaymentProvider._setup_payment_method(code)
|
|
|
|
|
|
def uninstall_hook(cr, registry):
|
|
""" Delete `account.payment.method` records created for the installed payment providers. """
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
installed_providers = env['payment.provider'].search([('module_id.state', '=', 'installed')])
|
|
env['account.payment.method'].search([
|
|
('code', 'in', installed_providers.mapped('code')),
|
|
('payment_type', '=', 'inbound'),
|
|
]).unlink()
|