2 答案
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.
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