Skip to Content
Menu
This question has been flagged
1 Reply
3030 Views

how can i add a custom field (of sale_order_line) to the Stock-Picking Return-Items dialog?

i tried to add a related field as:

class ReturnPickingLine(models.TransientModel):
_inherit = "stock.return.picking.line"
custom_field = fields.Char(related='move_id.sale_line_id.my_custom_Field', string="Farbcode")
and wanted to show it in stock.view_stock_return_picking_form but without success.

any ideas how to realize that?


UPDATE:

i add the field in xml LIKE:

<record id="stock_inherit_view_stock_return_picking_form" model="ir.ui.view">
<field name="model">stock.location
<field name="inherit_id" ref="stock.view_stock_return_picking_form"/>
<field name="arch" type="xml">
< xpath expr="//field[@name='product_id']" position="after">
<field name="custom_field"/>
</xpath>
</field>
</record>

Avatar
Discard
Best Answer

Try below code 

class ReturnPickingLine(models.TransientModel):
_inherit = "stock.return.picking.line"
   move_id =  fields.Many2one('stock.move',string="Moves)                          
 custom_field = fields.Char(related='move_id.sale_line_id.my_custom_Field', string="Farbcode")


Avatar
Discard
Author

if i add it with upper (Updated) XML Code now i get the error that the field custom_field does not exist