From 85f3f5d662d3ad2739b7031c5cdf5c8447de2d8e Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Mon, 6 May 2019 06:29:16 +0000 Subject: [PATCH] [IMP] payment: make non-essential field not required This prevent the uninstallation of all payment provider through the NOT NULL constraint. There is no reason for this field to be explicitely required - it will fail if the template is wrong anyway. closes odoo/odoo#33170 Signed-off-by: Damien Bouvy (dbo) --- addons/payment/models/payment_acquirer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 239eeb82512..9de056039df 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -74,7 +74,7 @@ class PaymentAcquirer(models.Model): 'res.company', 'Company', default=lambda self: self.env.user.company_id.id, required=True) view_template_id = fields.Many2one( - 'ir.ui.view', 'Form Button Template', required=True, + 'ir.ui.view', 'Form Button Template', default=_get_default_view_template_id) registration_view_template_id = fields.Many2one( 'ir.ui.view', 'S2S Form Template', domain=[('type', '=', 'qweb')], @@ -370,6 +370,9 @@ class PaymentAcquirer(models.Model): if values is None: values = {} + if not self.view_template_id: + return None + values.setdefault('return_url', '/payment/process') # reference and amount values.setdefault('reference', reference)