Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

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

By
supreeth
on 5/20/16, 2:20 PM 329 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?

Can you post the entire error message?

IBS
on 5/20/16, 5:11 PM
0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 5/21/16, 2:43 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/20/16, 2:20 PM
Seen: 329 times
Last updated: 5/21/16, 2:43 AM