Skip to Content
Menu
This question has been flagged
1 Reply
4089 Views

Hi !

I'm trying to create a server action that validate delivery order and confirm the backorder creation.

I have problem to interact with backorder wizard (?) ....
I tried so many different code but I tried this :
for rec in records:
action=rec.button_validate()
action=rec.env['\stock.backorder.confirmation'].process()

And this is the error I get :

File "/home/odoo/src/odoo/14.0/addons/web/controllers/main.py", line 1746, in run
return clean_action(result, env=action.env) if result else False
File "/home/odoo/src/odoo/14.0/addons/web/controllers/main.py", line 328, in clean_action
action_type = action.setdefault('type', 'ir.actions.act_window_close')
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/src/odoo/14.0/odoo/http.py", line 640, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/14.0/odoo/http.py", line 316, in _handle_exception
raise exception.with_traceback(None) from new_cause
AttributeError: 'bool' object has no attribute 'setdefault'


Any Idea ?

Thanks

Avatar
Discard
Author Best Answer

Hi !

The solution in V14 is to use context to skip the backoffice wizard  :
ID_to_valid.with_context({'skip_backorder': True}).button_validate()

Hope it help !

Bye !

Avatar
Discard

Do you know how I can do this in a similar way for create invoice button on sale order. Theres also a wizard that pop up asking type of invoice.

Related Posts Replies Views Activity
0
Mar 15
2801
1
Mar 15
4335
3
Aug 20
3378
0
Oct 19
1938
1
Aug 17
2440