Help

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

Add new columns inside Delivery Order lines

Avatar
odoo
Avatar
Discard
2 Answers
0
Avatar
odoo
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
0
Avatar
odoo
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