Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2013 Lượt xem

I have developed a function in Odoo that provides an action.

Here is the function:

def otp_action_view(self):
action = self.env['ir.actions.act_window']._for_xml_id('pos_backend_workflow.otp_wizard_action')
action['context'] = {'default_partner_id': self.id}
return action

Then I want to call this function in onchange function to return this action

Here is the onchange function:

@api.onchange('name','firstname')
def otp_retrive_action(self):
if self.parent_id:
print('This is a child')
action = self.otp_action_view()
return action
else:
return {}


The printing message 'This is a child' appears in your log, it indicates that the otp_retrive_action function is being triggered and executed successfully but the action did not triggered , any help?

BR


Ảnh đại diện
Huỷ bỏ

Hi, what is the need to call the function, directly return the window action in on change function
@api.onchange('name','firstname')
def otp_retrive_action(self):
if self.parent_id:
print('This is a child')
action = self.env['ir.actions.act_window']._for_xml_id('pos_backend_workflow.otp_wizard_action')
action['context'] = {'default_partner_id': self.id}
return action
else:
return {}

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 25
2556
1
thg 7 25
968
1
thg 8 25
1151
0
thg 5 25
1407
2
thg 4 25
3597