Odoo Help

0

Nobody can answer why active_id does not work here

By
E.M.
on 2/12/16, 8:15 AM 985 views

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>

0
Zbik
On 2/12/16, 8:45 AM

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

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.

Register

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)

Stats

Asked: 2/12/16, 8:15 AM
Seen: 985 times
Last updated: 2/12/16, 8:45 AM