[NEW] account_move_protect_deleting

This commit is contained in:
Boris Gallet
2024-03-27 11:45:05 +01:00
committed by Clément
parent e802b45728
commit 35d919ba22
8 changed files with 781 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import account_move

View File

@@ -0,0 +1,15 @@
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."
))