[IMP] account_advanced_protection_features: be able to manage prevent_reset_to_draft_sent_invoice option in sale journals
This commit is contained in:
@@ -1 +1,2 @@
|
||||
from . import account_move
|
||||
from . import account_move
|
||||
from . import account_journal
|
||||
|
@@ -0,0 +1,6 @@
|
||||
from odoo import models, fields
|
||||
|
||||
class AccountJournal(models.Model):
|
||||
_inherit = "account.journal"
|
||||
|
||||
prevent_reset_to_draft_sent_invoice = fields.Boolean("Prevent to reset to draft a sent invoice")
|
@@ -8,7 +8,7 @@ class AccountMove(models.Model):
|
||||
|
||||
def button_draft(self):
|
||||
res = super(AccountMove, self).button_draft()
|
||||
if self.sent_by_email:
|
||||
if self.sent_by_email and self.journal_id.prevent_reset_to_draft_sent_invoice:
|
||||
raise UserError(_(
|
||||
"You cannot reset to draft this invoice because it has been sent by email."
|
||||
))
|
||||
|
Reference in New Issue
Block a user