[IMP] account_advanced_protection_features: correct function button_draft when called on multiple moves
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m27s

This commit is contained in:
2026-01-07 16:56:30 +01:00
parent c7254a7b84
commit a948a466cc
3 changed files with 59 additions and 5 deletions

View File

@@ -5,11 +5,12 @@ class AccountMove(models.Model):
_inherit = 'account.move'
def button_draft(self):
if self.is_move_sent 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."
))
return super(AccountMove, self).button_draft()
for move in self:
if move.is_move_sent and move.journal_id.prevent_reset_to_draft_sent_invoice:
raise UserError(_(
"You cannot reset to draft this invoice because it has been sent by email."
))
return super().button_draft()
@api.ondelete(at_uninstall=False)
def _check_posted(self):