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.

3

How to insert value to a one2many field using context from xml?

By
Sebin Siby
on 5/26/16, 2:03 AM 507 views

<record id="view_stock_quant_tree_inherit" model="ir.ui.view">

    <field name="name">stock.quant.tree.inherit</field>

    <field name="model">stock.quant</field>

    <field name="inherit_id" ref="stock.view_stock_quant_tree"/>

    <field name="arch" type="xml">

        <data>

            <xpath expr="//field[@name='inventory_value']" position="after">

                <button name="%(act_stock_move)d" type="action" context="{'default_location_id': location_id, 'product_id': product_id, 'default_move_lines': [(0, 0, {'product_id':product_id, 'product_uom_qty': 10})]}" string="Move Stock"/>

            </xpath>

        </data>

</field>

</record>

<record id="act_stock_move" model="ir.actions.act_window">

    <field name="name">New Stock Move</field>

    <field name="res_model">stock.picking</field>

    <field name="view_id" ref="stock.view_picking_form"/>

    <field name="target">new</field>

</record>


Can I do something like this??

I just want to create a stock move which will move the selected product from one location to other??

I am unable to set the field "move_lines" which is a one2many field.

Can anyone help me?

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: 5/26/16, 2:03 AM
Seen: 507 times
Last updated: 9/6/16, 9:49 AM