From 3eed8919767f3be2c88d7578edfd5ea83893058b Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Sun, 2 Nov 2025 14:33:49 +0100 Subject: [PATCH] Fix typo in intrastat_declaration when cancelling moves Closes #14331 --- modules/account_stock_eu/stock.py | 2 +- .../tests/scenario_account_stock_eu_arrival.rst | 10 ++++++++++ .../tests/scenario_account_stock_eu_dispatch.rst | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/modules/account_stock_eu/stock.py b/modules/account_stock_eu/stock.py index 15ee628dd4..b9ec85c21e 100644 --- a/modules/account_stock_eu/stock.py +++ b/modules/account_stock_eu/stock.py @@ -231,7 +231,7 @@ class Move(metaclass=PoolMeta): 'account.stock.eu.intrastat.declaration') super().cancel(moves) declarations = { - m.declaration for m in moves if m.intrastat_declaration} + m.intrastat_declaration for m in moves if m.intrastat_declaration} if declarations: IntrastatDeclaration.open( IntrastatDeclaration.browse(declarations)) diff --git a/modules/account_stock_eu/tests/scenario_account_stock_eu_arrival.rst b/modules/account_stock_eu/tests/scenario_account_stock_eu_arrival.rst index 239168cac4..54a7a4d204 100644 --- a/modules/account_stock_eu/tests/scenario_account_stock_eu_arrival.rst +++ b/modules/account_stock_eu/tests/scenario_account_stock_eu_arrival.rst @@ -375,3 +375,13 @@ Export declaration as fallback:: ... b'arrival,FR,2,9403 10 51,15.0,750.00,21,5.0,,\r\n') >>> export.form.filename.endswith('.csv') True + +Cancelling the shipment reopens the declaration:: + + >>> shipment.click('cancel') + >>> shipment.state + 'cancelled' + + >>> declaration.reload() + >>> declaration.state + 'opened' diff --git a/modules/account_stock_eu/tests/scenario_account_stock_eu_dispatch.rst b/modules/account_stock_eu/tests/scenario_account_stock_eu_dispatch.rst index 599fc07f63..0680fa6247 100644 --- a/modules/account_stock_eu/tests/scenario_account_stock_eu_dispatch.rst +++ b/modules/account_stock_eu/tests/scenario_account_stock_eu_dispatch.rst @@ -386,3 +386,13 @@ Export declaration as fallback:: ... if intrastat_extended else ... b'dispatch,FR,2,9403 10 51,60.0,1800.00,12,20.0,CN,\r\n' ... b'dispatch,FR,2,9403 10 51,15.0,750.00,21,5.0,CN,FR40303265045\r\n') + +Cancelling the shipment reopens the declaration:: + + >>> shipment.click('cancel') + >>> shipment.state + 'cancelled' + + >>> declaration.reload() + >>> declaration.state + 'opened'