From d7a757317249ec61fbe02325afa29e0698a7294b Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Thu, 30 Apr 2026 08:24:15 +0000 Subject: [PATCH 1/3] [IMP] stock_valuation_fifo_lot: add validation error when there is no quant for lot in revaluation --- .../wizard/stock_valuation_layer_revaluation.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py b/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py index 782afe8d..0e8106e2 100644 --- a/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py +++ b/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) from odoo import _, api, fields, models -from odoo.exceptions import UserError +from odoo.exceptions import UserError, ValidationError from odoo.tools import float_compare, float_is_zero @@ -105,6 +105,13 @@ def action_validate_revaluation(self): ("location_id.usage", "=", "internal"), ] ) + if not quants: + raise ValidationError( + _( + "No quant found for the given lot and can't do revaluation. " + "Please ensure the lot is in an internal location." + ) + ) quants = quants.with_context( inventory_name=description, lot_revaluation_account=self.account_id, From 6f36cd45c9f61f03fe9afd536e83a6c04dd620f7 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Wed, 13 May 2026 02:24:13 +0000 Subject: [PATCH 2/3] fixup --- .../wizard/stock_valuation_layer_revaluation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py b/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py index 0e8106e2..3cd6d218 100644 --- a/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py +++ b/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) from odoo import _, api, fields, models -from odoo.exceptions import UserError, ValidationError +from odoo.exceptions import UserError from odoo.tools import float_compare, float_is_zero @@ -106,7 +106,7 @@ def action_validate_revaluation(self): ] ) if not quants: - raise ValidationError( + raise UserError( _( "No quant found for the given lot and can't do revaluation. " "Please ensure the lot is in an internal location." From c5ce38f7c7141ed397a1729dadaf5e0fa6f571c6 Mon Sep 17 00:00:00 2001 From: "Toshikimi Shigenobu (Quartile)" Date: Wed, 13 May 2026 18:18:45 +0900 Subject: [PATCH 3/3] Update Japanese translations for the error messages --- stock_valuation_fifo_lot/i18n/ja.po | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stock_valuation_fifo_lot/i18n/ja.po b/stock_valuation_fifo_lot/i18n/ja.po index bd577bfe..ab7d707c 100644 --- a/stock_valuation_fifo_lot/i18n/ja.po +++ b/stock_valuation_fifo_lot/i18n/ja.po @@ -141,6 +141,15 @@ msgstr "" msgid "No Reason Given" msgstr "理由が指定されていません" +#. module: stock_valuation_fifo_lot +#. odoo-python +#: code:addons/stock_valuation_fifo_lot/wizard/stock_valuation_layer_revaluation.py:0 +#, python-format +msgid "" +"No quant found for the given lot and can't do revaluation. Please ensure the" +" lot is in an internal location." +msgstr "指定ロットの在庫数量が見つからず、再評価できません。ロットが内部ロケーションにあることを確認してください。" + #. module: stock_valuation_fifo_lot #: model:ir.model,name:stock_valuation_fifo_lot.model_stock_move_line msgid "Product Moves (Stock Move Line)"