i have created a custom field "designation" in 'stock.picking' , now i want to get the value of the description of the product (in purchase.order) in that field automatically when user push in the button " Reception by item" (in my custom field)
------------------------------------------------------------------------------
stock_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="bl_stock_picking_tree" model="ir.ui.view">
<field name="name">bl.stock.picking.tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="num_bl"/>
<field name="designation"/>
</xpath>
</field>
</record>
<record id="bl_stock_picking_view_form" model="ir.ui.view">
<field name="name">bl.stock.picking.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="num_bl"/>
<field name="designation"/>
</xpath>
</field>
</record>
</data>
</openerp>
---------------------------------------------------------------------------------------------
from openerp.osv import fields, osv
from openerp import tools
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
class StockPicking(osv.osv):
_inherit = 'stock.picking'
def _get_designation(self,cr,uid,values,context=None):
designation=self.pool.get('purchase.order').browse(cr,uid,values.get('order_id')).product_uom.id
print StockQuantTreeDesignation
print values
return super (StockPicking,self).create(cr,uid,values,context)
_columns = {
'num_bl': fields.char( string="Numéro de BL fournisseur",required=True,select=True),
'designation': fields.char( string="Désignation",required=True,select=True,store=True, compute='_get_designation'),
}
-----------------------------------------------------------------------------------------------------
i have write this code but nothing is happened any help please