diff --git a/l10n_ar_ux/__manifest__.py b/l10n_ar_ux/__manifest__.py index 4e05ce322..63e5aa49c 100644 --- a/l10n_ar_ux/__manifest__.py +++ b/l10n_ar_ux/__manifest__.py @@ -1,6 +1,6 @@ { 'name': 'Argentinian Accounting UX', - 'version': "13.0.1.39.0", + 'version': "13.0.1.40.0", 'category': 'Localization/Argentina', 'sequence': 14, 'author': 'ADHOC SA', diff --git a/l10n_ar_ux/wizards/account_move_change_rate.py b/l10n_ar_ux/wizards/account_move_change_rate.py index 0466ef571..e6b374b6b 100644 --- a/l10n_ar_ux/wizards/account_move_change_rate.py +++ b/l10n_ar_ux/wizards/account_move_change_rate.py @@ -3,6 +3,7 @@ # directory ############################################################################## from odoo import fields, models, api, _ +from odoo.exceptions import ValidationError class AccountMoveChangeRate(models.TransientModel): @@ -26,6 +27,13 @@ def get_move(self): default=get_move ) + @api.constrains('currency_rate') + def _prevent_change_currency(self): + """prevent currency change when the invoice is not draft + """ + if self.move_id.state != 'draft': + raise ValidationError(_('This invoice is not draft, reset it to draft to change currency rate')) + @api.onchange('move_id') def _onchange_move(self): self.currency_rate = self.move_id.l10n_ar_currency_rate or self.move_id.computed_currency_rate