Skip to Content
Menu
This question has been flagged
2 Replies
8619 Views

Hi all,

I have created a button and wrote function for that like, when i click on that button new pop-up form should open.

xml:

<button name="button_method" string="Test Drive Type" type="object" class="btn-primary"/>

py:

        @api.multi
def button_method(self):
view_ref = self.pool.get('ir.model.data').get_object_reference('autochip', 'so_on_form')
view_id = view_ref and view_ref[1] or False
return {
'type': 'ir.actions.act_window',
'res_model': 'test.drive.allocation',
'view_type': 'form',
'view_mode': 'form',
        'views': [(view_id, 'form')],
'view_id': view_id,
'target':'new',
}


When i click on button i am getting 

TypeError: <built-in function id> is not JSON serializable 

i am not able to find what is the issue?

what is wrong?

Avatar
Discard

Can you post the entire error message?

Best Answer

Hello,

Usually if the button should open a new pop-up form it'll be of type action that calls the xml action's id to open the targeted form, you can check as an example here , also if you paste your error message it'll be helpful ..


Hope this could help

Avatar
Discard