Odoo Help

Welcome!

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.

0

Nobody can answer why active_id does not work here

By
E.M.
on 2/12/16, 8:15 AM 599 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

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 2/12/16, 8:45 AM

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

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)

Stats

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