Files
account-tools/account_move_protect_deleting/models/account_move.py
2024-03-27 11:45:05 +01:00

15 lines
452 B
Python

from odoo import models, api, _
from odoo.exceptions import UserError
class AccountMove(models.Model):
_inherit = 'account.move'
@api.ondelete(at_uninstall=False)
def _check_name(self):
""" Prevent deletion of a account move if it has been posted "/"
"""
if (self.posted_before) :
raise UserError(_(""
"You cannot delete this account move because it has been validated."
))