Files
odoo_source/addons/payment/__init__.py
T
Nicolas Lempereur 844a4cb49b [FIX] payment: payment acquirer disabled on uninstall
When we uninstall a payment acquirer, its state should be `disabled`
because when we succedingly reinstall it, we want the
required_if_provider fields to possibly be unset (which is only possible
if the state is not in `enabled` or `test`).

opw-2223094
closes #49033

closes odoo/odoo#49061

X-original-commit: ddf07ef2d9741d1db546efb1364718ff9e247aaf
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-04-06 13:26:23 +00:00

18 lines
546 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, SUPERUSER_ID
from . import models
from . import controllers
from . import wizards
def reset_payment_provider(cr, registry, provider):
env = api.Environment(cr, SUPERUSER_ID, {})
acquirers = env['payment.acquirer'].search([('provider', '=', provider)])
acquirers.write({
'view_template_id': acquirers._get_default_view_template_id().id,
'provider': 'manual',
'state': 'disabled',
})