[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) <dbo@odoo.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user