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) >>> config = activate_modules('account', create_company, create_chart)
>>> Warning = Model.get('res.user.warning')
Get currency:: Get currency::
>>> usd = get_currency('USD') >>> usd = get_currency('USD')
@@ -144,14 +146,12 @@ Cancelling the delegation move::
>>> try: >>> try:
... cancel.execute('cancel') ... cancel.execute('cancel')
... except CancelDelegatedWarning as warning: ... except CancelDelegatedWarning as warning:
... _, (key, *_) = warning.args ... Warning(user=config.user, name=warning.name).save()
... raise ... raise
Traceback (most recent call last): Traceback (most recent call last):
... ...
CancelDelegatedWarning: ... CancelDelegatedWarning: ...
>>> Warning = Model.get('res.user.warning')
>>> Warning(user=config.user, name=key).save()
>>> cancel.execute('cancel') >>> cancel.execute('cancel')
>>> Reconciliation.find([('id', '=', reconciliations[0].id)]) >>> Reconciliation.find([('id', '=', reconciliations[0].id)])
[] []
@@ -86,8 +86,8 @@ Bypass the warning and cancel the move::
>>> try: >>> try:
... cancel_move.execute('cancel') ... cancel_move.execute('cancel')
... except CancelInvoiceMoveWarning as e: ... except CancelInvoiceMoveWarning as warning:
... Warning(user=config.user, name=e.name).save() ... Warning(user=config.user, name=warning.name).save()
>>> cancel_move.execute('cancel') >>> cancel_move.execute('cancel')
>>> cancel_move.state >>> cancel_move.state
'end' 'end'
@@ -177,12 +177,11 @@ Create invoice with alternate currency and negative taxes::
>>> try: >>> try:
... invoice.click('post') ... invoice.click('post')
... except InvoiceTaxesWarning as warning: ... except InvoiceTaxesWarning as warning:
... _, (key, *_) = warning.args ... Warning(user=config.user, name=warning.name).save()
... raise ... raise
Traceback (most recent call last): Traceback (most recent call last):
... ...
InvoiceTaxesWarning: ... InvoiceTaxesWarning: ...
>>> Warning(user=config.user, name=key).save()
>>> invoice.click('post') >>> invoice.click('post')
>>> invoice.state >>> invoice.state
'posted' 'posted'
@@ -89,12 +89,11 @@ Post a supplier invoice with 0% deductible::
>>> try: >>> try:
... invoice.click('post') ... invoice.click('post')
... except InvoiceTaxesWarning as warning: ... except InvoiceTaxesWarning as warning:
... _, (key, *_) = warning.args ... Warning(user=config.user, name=warning.name).save()
... raise ... raise
Traceback (most recent call last): Traceback (most recent call last):
... ...
InvoiceTaxesWarning: ... InvoiceTaxesWarning: ...
>>> Warning(user=config.user, name=key).save()
>>> invoice.click('post') >>> invoice.click('post')
>>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount >>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount
(Decimal('550.00'), Decimal('0.00'), Decimal('550.00')) (Decimal('550.00'), Decimal('0.00'), Decimal('550.00'))
@@ -200,12 +200,11 @@ Add a second shipment cost to 1 shipment::
>>> try: >>> try:
... post_shipment_cost.execute('post') ... post_shipment_cost.execute('post')
... except SamePartiesWarning as warning: ... except SamePartiesWarning as warning:
... _, (key, *_) = warning.args ... Warning(user=config.user, name=warning.name).save()
... raise ... raise
Traceback (most recent call last): Traceback (most recent call last):
... ...
SamePartiesWarning: ... SamePartiesWarning: ...
>>> Warning(user=config.user, name=key).save()
>>> post_shipment_cost.execute('post') >>> post_shipment_cost.execute('post')
>>> shipment_cost2.state >>> shipment_cost2.state
'posted' 'posted'
@@ -18,6 +18,8 @@ Activate modules::
>>> config = activate_modules('stock_supply_production', create_company) >>> config = activate_modules('stock_supply_production', create_company)
>>> Warning = Model.get('res.user.warning')
Create product:: Create product::
>>> ProductUom = Model.get('product.uom') >>> ProductUom = Model.get('product.uom')
@@ -64,10 +66,7 @@ Create needs for product::
>>> try: >>> try:
... move.click('do') ... move.click('do')
... except MoveFutureWarning as warning: ... except MoveFutureWarning as warning:
... _, (key, *_) = warning.args ... Warning(user=config.user, name=warning.name).save()
>>> Warning = Model.get('res.user.warning')
>>> Warning(user=config.user, name=key).save()
>>> move.click('do') >>> move.click('do')
There is no production request:: There is no production request::