Standardise the skipping of warnings in the test scenario

This commit is contained in:
Cédric Krier
2025-11-27 16:59:05 +01:00
parent edb3c2c2d4
commit bc8a84feaa
6 changed files with 11 additions and 15 deletions
@@ -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)])
[]
@@ -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'
@@ -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'
@@ -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'))
@@ -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'
@@ -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::