From bc8a84feaa65e7e4e72651ed2f98a9d8cf594220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 27 Nov 2025 16:59:05 +0100 Subject: [PATCH] Standardise the skipping of warnings in the test scenario --- modules/account/tests/scenario_move_line_group.rst | 6 +++--- .../tests/scenario_cancelling_invoice_move.rst | 4 ++-- .../tests/scenario_invoice_alternate_currency.rst | 3 +-- .../tests/scenario_invoice_tax_deductible.rst | 3 +-- .../tests/scenario_account_stock_shipment_cost.rst | 3 +-- .../tests/scenario_stock_supply_production.rst | 7 +++---- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/modules/account/tests/scenario_move_line_group.rst b/modules/account/tests/scenario_move_line_group.rst index 4b27f2d1fc..86d159dee8 100644 --- a/modules/account/tests/scenario_move_line_group.rst +++ b/modules/account/tests/scenario_move_line_group.rst @@ -19,6 +19,8 @@ Activate modules:: >>> config = activate_modules('account', create_company, create_chart) + >>> Warning = Model.get('res.user.warning') + Get currency:: >>> usd = get_currency('USD') @@ -144,14 +146,12 @@ Cancelling the delegation move:: >>> try: ... cancel.execute('cancel') ... except CancelDelegatedWarning as warning: - ... _, (key, *_) = warning.args + ... Warning(user=config.user, name=warning.name).save() ... raise Traceback (most recent call last): ... CancelDelegatedWarning: ... - >>> Warning = Model.get('res.user.warning') - >>> Warning(user=config.user, name=key).save() >>> cancel.execute('cancel') >>> Reconciliation.find([('id', '=', reconciliations[0].id)]) [] diff --git a/modules/account_invoice/tests/scenario_cancelling_invoice_move.rst b/modules/account_invoice/tests/scenario_cancelling_invoice_move.rst index fdc438b0be..31fe50be69 100644 --- a/modules/account_invoice/tests/scenario_cancelling_invoice_move.rst +++ b/modules/account_invoice/tests/scenario_cancelling_invoice_move.rst @@ -86,8 +86,8 @@ Bypass the warning and cancel the move:: >>> try: ... cancel_move.execute('cancel') - ... except CancelInvoiceMoveWarning as e: - ... Warning(user=config.user, name=e.name).save() + ... except CancelInvoiceMoveWarning as warning: + ... Warning(user=config.user, name=warning.name).save() >>> cancel_move.execute('cancel') >>> cancel_move.state 'end' diff --git a/modules/account_invoice/tests/scenario_invoice_alternate_currency.rst b/modules/account_invoice/tests/scenario_invoice_alternate_currency.rst index c7816a4db4..694c606ab5 100644 --- a/modules/account_invoice/tests/scenario_invoice_alternate_currency.rst +++ b/modules/account_invoice/tests/scenario_invoice_alternate_currency.rst @@ -177,12 +177,11 @@ Create invoice with alternate currency and negative taxes:: >>> try: ... invoice.click('post') ... except InvoiceTaxesWarning as warning: - ... _, (key, *_) = warning.args + ... Warning(user=config.user, name=warning.name).save() ... raise Traceback (most recent call last): ... InvoiceTaxesWarning: ... - >>> Warning(user=config.user, name=key).save() >>> invoice.click('post') >>> invoice.state 'posted' diff --git a/modules/account_invoice/tests/scenario_invoice_tax_deductible.rst b/modules/account_invoice/tests/scenario_invoice_tax_deductible.rst index e20dddb000..5db4bb0a58 100644 --- a/modules/account_invoice/tests/scenario_invoice_tax_deductible.rst +++ b/modules/account_invoice/tests/scenario_invoice_tax_deductible.rst @@ -89,12 +89,11 @@ Post a supplier invoice with 0% deductible:: >>> try: ... invoice.click('post') ... except InvoiceTaxesWarning as warning: - ... _, (key, *_) = warning.args + ... Warning(user=config.user, name=warning.name).save() ... raise Traceback (most recent call last): ... InvoiceTaxesWarning: ... - >>> Warning(user=config.user, name=key).save() >>> invoice.click('post') >>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount (Decimal('550.00'), Decimal('0.00'), Decimal('550.00')) diff --git a/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst b/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst index 21bb24047d..6d576b0ee8 100644 --- a/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst +++ b/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst @@ -200,12 +200,11 @@ Add a second shipment cost to 1 shipment:: >>> try: ... post_shipment_cost.execute('post') ... except SamePartiesWarning as warning: - ... _, (key, *_) = warning.args + ... Warning(user=config.user, name=warning.name).save() ... raise Traceback (most recent call last): ... SamePartiesWarning: ... - >>> Warning(user=config.user, name=key).save() >>> post_shipment_cost.execute('post') >>> shipment_cost2.state 'posted' diff --git a/modules/stock_supply_production/tests/scenario_stock_supply_production.rst b/modules/stock_supply_production/tests/scenario_stock_supply_production.rst index 151cbf26a1..2ecadfcf8b 100644 --- a/modules/stock_supply_production/tests/scenario_stock_supply_production.rst +++ b/modules/stock_supply_production/tests/scenario_stock_supply_production.rst @@ -18,6 +18,8 @@ Activate modules:: >>> config = activate_modules('stock_supply_production', create_company) + >>> Warning = Model.get('res.user.warning') + Create product:: >>> ProductUom = Model.get('product.uom') @@ -64,10 +66,7 @@ Create needs for product:: >>> try: ... move.click('do') ... except MoveFutureWarning as warning: - ... _, (key, *_) = warning.args - - >>> Warning = Model.get('res.user.warning') - >>> Warning(user=config.user, name=key).save() + ... Warning(user=config.user, name=warning.name).save() >>> move.click('do') There is no production request::