From 1daf8eb12735db5c697e4a0868b43fe44f6b2f6a Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Thu, 20 Feb 2020 13:43:00 +0000 Subject: [FIX] *: set ondelete policy of required Selection fields With this commit, Selection fields with `required=True` which are extended via `selection_add` are given proper ondelete policies to ensure the cleanup of records containing these extended options during uninstall of the extending module. This commit also cleans up leftover uninstall hooks that were being used to handle the same set of problems prior to the ondelete mechanism being implemented for Selection fields. closes odoo/odoo#46325 Related: odoo/enterprise#9117 Signed-off-by: Raphael Collet (rco) --- addons/payment_authorize/models/payment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/payment_authorize') diff --git a/addons/payment_authorize/models/payment.py b/addons/payment_authorize/models/payment.py index d6e08fda0e5..3c89c36b5da 100644 --- a/addons/payment_authorize/models/payment.py +++ b/addons/payment_authorize/models/payment.py @@ -19,7 +19,9 @@ _logger = logging.getLogger(__name__) class PaymentAcquirerAuthorize(models.Model): _inherit = 'payment.acquirer' - provider = fields.Selection(selection_add=[('authorize', 'Authorize.Net')]) + provider = fields.Selection(selection_add=[ + ('authorize', 'Authorize.Net') + ], ondelete={'authorize': 'set default'}) authorize_login = fields.Char(string='API Login Id', required_if_provider='authorize', groups='base.group_user') authorize_transaction_key = fields.Char(string='API Transaction Key', required_if_provider='authorize', groups='base.group_user') authorize_signature_key = fields.Char(string='API Signature Key', required_if_provider='authorize', groups='base.group_user') -- cgit v1.2.3