Python side :
On stock_picking there is of course a one2many relation with stock moves.
'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}),
I added a field on stock_move like this (with custom module):
class StockMove(osv.osv):
_inherit = 'stock.move'
_columns = {
'prix_unitaire': fields.float('Prix unitaire'),
}
StockMove()
Now I want to add this field on the view side, on the one2many move lines relationship with stock_picking.
Explanations about View side :
On "view picking_out_form" the stock move lines of "view_picking_form" are overrided like this :
<record id="view_picking_out_form" model="ir.ui.view">
<field name="name">stock.picking.out.form</field>
<field name="model">stock.picking.out</field>
<field name="inherit_id" ref="view_picking_form"/>
<field name="arch" type="xml"><xpath expr="//field[@name='move_lines']" position="replace">
<field name="move_lines" string="Stock Move" context="{'address_out_id': partner_id, 'picking_type': 'out', 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'stock.view_move_picking_tree'}" options='{"reload_on_button": true}'>
</field>
</xpath>
</field>
</record>
Because "view_picking_form" is the main view, giving possiblities to create several views based on it. openerp creates the "picking_out_form" ( delivery orders) and "picking_in_form" for any incoming shipements.
I noticed that there is no tree for the move_lines field, i expected to find a structure like this :
<xpath expr="//field[@name='move_lines']" position="replace">
<field name="move_lines" string="Stock Move" context="{'address_out_id': partner_id, 'picking_type': 'out', 'form_view_ref':'stock.view_move_picking_form', 'tree_view_ref':'stock.view_move_picking_tree'}" options='{"reload_on_button": true}'>
<tree string="Move lines Valued" editable="bottom">
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field name="location_dest_id"/>
<field name="state"/>
</tree>
</field>
</xpath>
This structure gives possibility to customize the one2many stock_move relation.
Why the move_lines are implemented like this ?
How to customize it ? is there anyway to override this kind of one2many view implementation ?
The purpose is to add the new field I have created on stock.move object, on the one2many field.
Any suggestions please ?