This question has been flagged
1985 Views

I want to add a "designation" field in the "stock.quant.tree" view that displays the description of each product in stock. I have already added the field in the tree but I am stuck how I get the value of the description of the model "purchase.order". Any idea for help please?

stock_quant_tree_designation.xml 

<?xml version="1.0" encoding="utf-8"?>

<openerp>

    <data>

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

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

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

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

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

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

                            <field name="designation2"/>

                </xpath>

            </field>

        </record>

    </data>

</openerp>


stock.py
from openerp.osv import fields, osv 
from openerp import tools , api
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
class StockQuantTreeDesignation(osv.osv):
    _inherit = 'stock.quant'
    _columns = {
'designation2': fields.char(string="Désignation", required=True, select=True),
 }
    
Avatar
Discard
Author

https://ibb.co/ezkuhJ this is a photo to explain what i want