[NEW] account_move_protect_reset_to_draft

This commit is contained in:
clementthomas
2024-10-14 16:56:47 +02:00
parent 8f0218c43f
commit f4079c8f13
10 changed files with 856 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,15 @@
from odoo import models, api, _, fields
from odoo.exceptions import UserError
class AccountMove(models.Model):
_inherit = 'account.move'
sent_by_email = fields.Boolean()
def button_draft(self):
res = super(AccountMove, self).button_draft()
if self.sent_by_email:
raise UserError(_(
"You cannot reset to draft this invoice because it has been sent by email."
))
return res