Skip to Content
Menu
This question has been flagged

How can I add a new column inside delivery orders (stock.picking) under "Detailed Operation Tab" and "Operations" tab. Can I be provided with a piece of code regarding this issue? This is the code I am using to add a new column under "Detailed Operation Tab" but nothing is added:


id="view_stock_move_line_detailed_operation_tree_mrp" model="ir.ui.view">
name="name">stock.move.line.operations.tree.mrp
name="model">stock.move.line
name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
name="arch" type="xml">
expr="//field[@name='product_id']" position="after">
name="alternative_delivery_item" optional="show"/>



Avatar
Discard
Best Answer

Hi Moe,

You need to add the field in 2 tree view. one for the detailed Operations tab and one for normal Operations tab. 


For Detailed Operations Tab : Try this

≤record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view"≥
≤field name="name"≥stock.move.line.detail.operations.tree.mrp≤/field≥
≤field name="model"≥stock.move.line≤/field≥
≤field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/≥
≤field name="arch" type="xml"≥
≤xpath expr="//field[@name='product_id']" position="after"≥
≤field name="alternative_delivery_item" /≥
≤/xpath≥
≤/field≥
≤/record≥


For Operations Tab : Try this

≤record id="view_stock_move_custom_operation_form_mrp" model="ir.ui.view"≥
≤field name="name"≥stock.picking.custom.operations.form.mrp≤/field≥
≤field name="model"≥stock.picking≤/field≥
≤field name="inherit_id" ref="stock.view_picking_form"/≥
≤field name="arch" type="xml"≥
≤xpath expr="//page[@name='operations']/field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after"≥
≤field name="alternative_delivery_item"/≥
≤/xpath≥
≤/field≥
≤/record≥



Hope it will work for you.

Avatar
Discard
Best Answer

Hi,

To add a column in the delivery order lines 
First we have to add that field in python. For that inherit model 'stock.move.line'.

class StockMoveLine(models.Model):
_inherit = 'stock.move.line'

cost = fields.Float(string='Cost')

Then add to corresponding view.

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


    <field name="name">stock.move.line.cost</field>


    <field name="model">stock.move.line</field>


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


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


        <field name="product_uom_id" position="after">


            <field name="cost"/>


        </field>


    </field>


</record>


Regards

Avatar
Discard
Related Posts Replies Views Activity
0
Oct 23
539
1
Aug 24
424
2
Nov 24
760
3
Oct 23
13197
2
Feb 23
1229