Skip to Content
Menu
This question has been flagged
2 Replies
4921 Views

I have added my two custom field one to Sale.order.line and the anther to stock.move I want load the the value of the sale.order.line to stock.move in delivery process , In where I could find the dictionary to load my field value to stock.picking    

Avatar
Discard
Best Answer

how to pass value sale.order to stock.picking , below my code i am trying but not work please help me, i use odoo V14

class SaleTransportOrder(models.Model):

          _inherit = 'sale.order'

          transport_id = fields.Many2one('transport.management', string="Transport Via", required=True)
          def  action_confirm(self):

          rec = super(SaleTransportOrder, self).action_confirm()

           i = self.env['stock.picking'].create({'transport_id':self.transport_id.id, })

           returnrec

class   Stockpicking(models.Model):

            _inherit = "stock.picking"
            transport_id = fields.Many2one("transport.management",string="Transport Via",tracking=True,required=True ,           readonly=True)

Avatar
Discard
Best Answer

Hi Osman,

In order to get field value from sale order line to stock picking, you have to follow these steps:

1) First you have to find the method or code that create stock move record in sale order line.

2) From there you can pass that two fields in context in that method (using with_context)

3) Now, override or go to create method of stock move in that you will receive that two fields

4) So here you can do any operation to pass that field to stock picking or any else.

Hope it will useful for you..

Avatar
Discard