This question has been flagged

Nobody can answer this:


Why stock_picking_id field is not populated with the calling ID? (It is being called from a button in stock_picking form which launches the popup tree view):


# -*- coding: utf-8 -*-

from openerp import models, fields, api

class LabelPicking(models.TransientModel):
_name = "label.picking"
stock_picking_id = fields.Many2one(
'stock.picking',
required=True,
default=lambda self: self.env.context['active_id'],
)

XML:

<?xml version="1.0" encoding="utf-8" ?>
<openerp>
        <data>
                <record id="view_tree_label_picking" model="ir.ui.view">
                        <field name="name">Labels Dispatch Items Tree</field>
                        <field name="model">label.picking</field>
                        <field name="arch" type="xml">
                                <tree>
                                        <field name="stock_picking_id"/>
                                </tree>
                        </field>
                </record>
        </data>
</openerp>

Avatar
Discard
Best Answer

See this issue, maybe simillar problem: https://github.com/odoo/odoo/issues/4384

Avatar
Discard