Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
5215 มุมมอง

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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 !

อวตาร
ละทิ้ง

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 ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 25
1272
1
มี.ค. 15
5539
0
มี.ค. 15
3926
0
ก.ค. 25
356
Dynamic Form from Tree View แก้ไขแล้ว
3
ส.ค. 20
4445