Odoo Help


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.


Function Onchange Search value

on 12/10/15, 11:04 AM 277 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.


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)


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