Odoo18-Base/addons/l10n_sa_edi/wizard/account_move_reversal.py
2025-01-06 10:57:38 +07:00

16 lines
565 B
Python

# -*- coding: utf-8 -*-
from odoo import models
from odoo.tools.translate import _
from odoo.exceptions import UserError
class AccountMoveReversal(models.TransientModel):
_inherit = 'account.move.reversal'
def reverse_moves(self, is_modify=False):
self.ensure_one()
for move in self.move_ids:
if move.journal_id.country_code == 'SA' and not self.reason:
raise UserError(_("For Credit/Debit notes issued in Saudi Arabia, you need to specify a Reason"))
return super().reverse_moves(is_modify=is_modify)