Skip to Content
Menu
This question has been flagged
3019 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"/>
</tree>
</field>
</page>


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


Thanks

Avatar
Discard
Related Posts Replies Views Activity
0
Sep 23
498
0
Sep 23
451
2
Feb 23
9255
6
Oct 23
19293
3
Mar 24
7697