Scenario test (proteus) and permissions to save in "res.user.warning"

I have a scenario tests that work in 6.8 but when try to run in 7.0, user has not allow to write res.user.warning

Scenario code is:

    >>> set_user(stock_user)
    >>> Move = Model.get('stock.move')
    >>> ShipmentIn = Model.get('stock.shipment.in')
    >>> shipment = ShipmentIn()
    >>> shipment.supplier = supplier
    >>> for move in moves:
    ...     incoming_move = Move(id=move.id)
    ...     shipment.incoming_moves.append(incoming_move)
    >>> shipment.effective_date = today + datetime.timedelta(days=1)
    >>> shipment.save()
    >>> try:
    ...   shipment.click('receive')
    ... except MoveFutureWarning as warning:
    ...   _, (key, *_) = warning.args
    ...   raise  # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
      ...
    MoveFutureWarning: ...
    >>> Warning = Model.get('res.user.warning')
    >>> Warning(user=config.user, name=key).save()

when debug I receive:

(Pdb) Warning = Model.get('res.user.warning')
(Pdb) Warning(user=config.user, name=key).save()
*** trytond.model.modelstorage.AccessError: You are not allowed to access "User Warning". -
(Pdb) stock_user
proteus.Model.get('res.user')(3)
(Pdb) for group in stock_user.groups: group.rec_name
'Stock'

Testing warning in SAO is ok when user only has “stock” grup permissions . Why I receive “not allowed to access” in proteus scenario?

You must use the new skip method of res.user.warning.

thanks. Fixed!

-    >>> Warning(user=config.user, name=key).save()
+    >>> Warning.skip(key, True, config.context)

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.