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: res.partner(id,) is not JSON serializable

By
James Ford
on 3/23/16, 8:23 AM 519 views

I have a button on the sale.order.line model that opens a popup on the stock.picking model. The popup opens perfectly , but when I want to spend some fields default to popup, Odoo displays the following message:

TypeError: res.partner(id,) is not JSON serializable

In the following images shown how the popup:


http://es.zimagez.com/zimage/json0.php

http://es.zimagez.com/zimage/json2.php


This is the function that opens the popup:

    @api.multi
    def action_stock_picking(self):        
        self.ensure_one()
        picking_form = self.env.ref('stock.view_picking_form', False)
            return {
                'name': _('Formulario de Inventario: Recepciones'),
                'type': 'ir.actions.act_window',
                'view_type': 'form',
                'view_mode': 'form',
                'res_model': 'stock.picking',
                'views': [(picking_form.id, 'form')],
                'view_id': picking_form.id,
                'target': 'new',
                'context': dict(
          #partner_id stock.picking = partner_id sale.order.line

                    **default_partner_id=self.order_id.partner_id,**

                    default_origin=self.order_id.name,
                    default_picking_type_id = 1,
                    default_model='stock.picking',
                    default_res_id=self.id,
                    default_composition_mode='comment',
                    mark_invoice_as_sent=True,
                ),
            }

When I want to spend the client popup, Odoo shows the error that I mentioned previously.

Thank you very much to all. I hope some help from you.

0
Nilesh Sheliya
On 3/23/16, 9:47 AM
Just have to set partner_id like default_partner_id=self.order_id.partner_id.id instead of default_partner_id=self.order_id.partner_id,

@api.multi def action_stock_picking(self): self.ensure_one() picking_form = self.env.ref('stock.view_picking_form', False) return { 'name': _('Formulario de Inventario: Recepciones'), 'type': 'ir.actions.act_window', 'view_type': 'form', 'view_mode': 'form', 'res_model': 'stock.picking', 'views': [(picking_form.id, 'form')], 'view_id': picking_form.id, 'target': 'new', 'context': dict( #partner_id stock.picking = partner_id sale.order.line **default_partner_id=self.order_id.partner_id.id,** default_origin=self.order_id.name, default_picking_type_id = 1, default_model='stock.picking', default_res_id=self.id, default_composition_mode='comment', mark_invoice_as_sent=True, ), }

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: 3/23/16, 8:23 AM
Seen: 519 times
Last updated: 3/23/16, 9:47 AM