Changing the name of model payment.acquirer to payment.provider and everything that it touches. It is technically incorrect to use the term "acquirer" for systems that only provide a service of payment. After this commit the model payment.acquirer and all related to it will be renamed to payment.provider. Task - 2842088 closes odoo/odoo#90899 Related: odoo/upgrade#3542 Related: odoo/documentation#1981 Related: odoo/enterprise#27131 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
17 lines
714 B
Python
17 lines
714 B
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import _, api, models
|
|
from odoo.exceptions import UserError
|
|
|
|
|
|
class IrUiView(models.Model):
|
|
_inherit = 'ir.ui.view'
|
|
|
|
@api.ondelete(at_uninstall=False)
|
|
def _unlink_if_not_referenced_by_provider(self):
|
|
referencing_providers_sudo = self.env['payment.provider'].sudo().search([
|
|
'|', ('redirect_form_view_id', 'in', self.ids), ('inline_form_view_id', 'in', self.ids)
|
|
]) # In sudo mode to allow non-admin users (e.g., Website designers) to read the view ids.
|
|
if referencing_providers_sudo:
|
|
raise UserError(_("You cannot delete a view that is used by a payment provider."))
|