Odoo Help


Function Onchange Search value

on 12/10/15, 11:04 AM 790 views

i'm doing searching and display customer name from stock.picking for custom module.

    stock_picking_id = fields.Many2one('stock.picking', string='Delivery Order', ondelete='restrict', required=True)
stock_picking_customer = fields.Char(readonly=True, store=False, string='Customer')

def stock_picking_id_change(self, cr, uid, ids, stock_picking_id, context=None):

if stock_picking_id:

stock_picking_obj = self.pool.get('stock.picking') 

x = stock_picking_obj.browse(cr, uid, stock_picking_id, context=context)[0]

return {'value': {'stock_picking_customer': x.partner_id}}

return {'value': {}}

the return value are: res.partner(9,)

XML view:

                            <page string="Picking Lines">
<field name="order_line">
<tree editable="bottom">
<field name="stock_picking_id" string="Picking Number" on_change="stock_picking_id_change(stock_picking_id)"/>
<field name="stock_picking_customer" string="Customer"/>

How are the correct syntax? The return value should be customer name.


About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 12/10/15, 11:04 AM
Seen: 790 times
Last updated: 12/10/15, 3:04 PM