From 722224614f4a7f54fbdb5fb1da136d6d86fa04ec Mon Sep 17 00:00:00 2001 From: Dorin Hongu Date: Mon, 17 Aug 2026 11:36:54 +0300 Subject: [PATCH] [FIX] deltatech_stock_inventory: clear inventory note after applying MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The per-line Inventory Note was carried over to the generated stock move, but never cleared afterwards: action_apply_inventory only resets inventory_id and inventory_line_id, and the standard action_clear_inventory_quantity does not touch custom fields. A note left over from a previous count silently became the reference of the next adjustment on the same quant, so the move history showed a reason that belonged to an earlier operation. Confirmed on the customer's 18.0 production database (ticket #9156): after applying an adjustment, inventory_note was still set on the quant. Also adds the missing Romanian translation of the column label, which operators saw in English, and tests for both behaviours. One of the tests documents that the user name the standard appends to the reference comes from user_id (*Assigned To*), not from the user performing the adjustment — so the per-line note is the only per-product trace of the reason. This is a backport of the applicable part of PR #2794 (19.0). The 19.0 regression it fixed — the note not reaching the move at all — never existed on 18.0. Co-Authored-By: Claude Opus 5 --- deltatech_stock_inventory/__manifest__.py | 2 +- deltatech_stock_inventory/i18n/ro.po | 2 +- .../models/stock_quant.py | 4 +- deltatech_stock_inventory/readme/HISTORY.md | 10 ++ deltatech_stock_inventory/tests/__init__.py | 1 + .../tests/test_inventory_note.py | 93 +++++++++++++++++++ 6 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 deltatech_stock_inventory/tests/test_inventory_note.py diff --git a/deltatech_stock_inventory/__manifest__.py b/deltatech_stock_inventory/__manifest__.py index 9b8b3d406..5b7bc146a 100644 --- a/deltatech_stock_inventory/__manifest__.py +++ b/deltatech_stock_inventory/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Stock Inventory", "summary": "Inventory Old Method", - "version": "18.0.2.6.1", + "version": "18.0.2.6.2", "author": "Terrabit, Dorin Hongu", "website": "https://www.terrabit.ro", "category": "Warehouse", diff --git a/deltatech_stock_inventory/i18n/ro.po b/deltatech_stock_inventory/i18n/ro.po index 299e1cef5..c6b8caa0c 100644 --- a/deltatech_stock_inventory/i18n/ro.po +++ b/deltatech_stock_inventory/i18n/ro.po @@ -542,7 +542,7 @@ msgstr "" #. module: deltatech_stock_inventory #: model:ir.model.fields,field_description:deltatech_stock_inventory.field_stock_quant__inventory_note msgid "Inventory Note" -msgstr "" +msgstr "Notă inventar" #. module: deltatech_stock_inventory #: model:ir.model.fields,field_description:deltatech_stock_inventory.field_product_product__is_inventory_ok diff --git a/deltatech_stock_inventory/models/stock_quant.py b/deltatech_stock_inventory/models/stock_quant.py index 84c863b60..e77f5433b 100644 --- a/deltatech_stock_inventory/models/stock_quant.py +++ b/deltatech_stock_inventory/models/stock_quant.py @@ -92,7 +92,9 @@ def action_apply_inventory(self): values["name"] = sequence.next_by_id() inventory.write(values) - self.write({"inventory_id": False, "inventory_line_id": False}) + # Nota a fost preluata in referinta mișcării; o golim ca sa nu fie refolosita tacit + # la o ajustare ulterioara a aceluiași quant (standardul nu o curata). + self.write({"inventory_id": False, "inventory_line_id": False, "inventory_note": False}) return res def write(self, vals): diff --git a/deltatech_stock_inventory/readme/HISTORY.md b/deltatech_stock_inventory/readme/HISTORY.md index 0846155e8..9cbeb6ea4 100644 --- a/deltatech_stock_inventory/readme/HISTORY.md +++ b/deltatech_stock_inventory/readme/HISTORY.md @@ -1,3 +1,13 @@ +## 18.0.2.6.2 (2026-08-17) + +- The **Inventory Note** is cleared when the adjustment is applied, so it is not + silently reused as the reason of a later adjustment on the same quant. The + standard `action_clear_inventory_quantity` does not reset custom fields, so a + note left over from a previous count became the reference of the next stock + move without the operator noticing. +- Adds the missing Romanian translation of the column label ("Notă inventar"), + which was shown in English to operators, and tests for both behaviours. + ## 18.0.2.6.1 (2026-08-03) - The **Inventory Note** column in the inventory adjustment list is now shown by diff --git a/deltatech_stock_inventory/tests/__init__.py b/deltatech_stock_inventory/tests/__init__.py index 6f9dcd203..bb07ea7db 100644 --- a/deltatech_stock_inventory/tests/__init__.py +++ b/deltatech_stock_inventory/tests/__init__.py @@ -8,3 +8,4 @@ from . import test_product_methods from . import test_stock_inventory_methods_extra from . import test_compute_warehouse_stocks +from . import test_inventory_note diff --git a/deltatech_stock_inventory/tests/test_inventory_note.py b/deltatech_stock_inventory/tests/test_inventory_note.py new file mode 100644 index 000000000..e64117aa2 --- /dev/null +++ b/deltatech_stock_inventory/tests/test_inventory_note.py @@ -0,0 +1,93 @@ +# © 2026 Deltatech +# Dorin Hongu