Skip to content

Commit

Permalink
IMP use self.env._
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhao committed Nov 11, 2024
1 parent 4b19155 commit d3a8636
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions account_move_tier_validation/models/account_move.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright <2020> PESOL <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)

from odoo import _, api, models
from odoo import api, models


class AccountMove(models.Model):
Expand All @@ -25,13 +25,13 @@ def _get_under_validation_exceptions(self):
def _get_to_validate_message_name(self):
name = super()._get_to_validate_message_name()
if self.move_type == "in_invoice":
name = _("Bill")
name = self.env._("Bill")
elif self.move_type == "in_refund":
name = _("Refund")
name = self.env._("Refund")
elif self.move_type == "out_invoice":
name = _("Invoice")
name = self.env._("Invoice")
elif self.move_type == "out_refund":
name = _("Credit Note")
name = self.env._("Credit Note")
return name

def action_post(self):
Expand Down
4 changes: 2 additions & 2 deletions account_move_tier_validation/tests/test_tier_validation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2018 ForgeFlow S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import _, fields
from odoo import fields
from odoo.exceptions import ValidationError
from odoo.tests import Form
from odoo.tests.common import TransactionCase, tagged
Expand Down Expand Up @@ -76,7 +76,7 @@ def test_03_move_post(self):
invoice.invalidate_model()
invoice.validate_tier()
with self.assertRaisesRegex(
ValidationError, _("You are not allowed to write those fields")
ValidationError, self.env._("You are not allowed to write those fields")
):
invoice._post()
# Calls _post method by passing context skip_validation_check set to True
Expand Down

0 comments on commit d3a8636

Please sign in to comment.