Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged

I'm trying to create delivery order for each warehouse in sale order line
from where can get value of 'picking_type_id' of the delivery order?

class SaleOrder(models.Model):
_inherit = 'sale.order'
@api.model
def action_confirm(self):
res = super(SaleOrder, self)
oreders = res.order_line
for loc in oreders.mapped('warehous_id'):
line = oreders.filtered(lambda o: o.warehous_id.id == loc.id)
picking_vals = {
'origin': res.name,
'partner_id': res.partner_shipping_id.id,
'location_id': loc.lot_stock_id.id,
'location_dest_id': res.partner_shipping_id.property_stock_customer.id,
'picking_type_id':loc.out_type_id.id,

I used the following fields but it deoesn't work correctly

Avatar
Opusti
Best Answer

Hi,


The picking type of delivery order is outgoing


_inherit = 'sale.order'


    op_type = self.env['stock.picking.type'].search(

                    [('code', '=', 'outgoing')])


    @api.model

    def action_confirm(self):

        res = super(SaleOrder, self)

        orders = res.order_line

        for loc in orders.mapped('warehous_id'):

            line = orders.filtered(lambda o: o.warehous_id.id == loc.id)

            picking_vals = {

                    'origin': res.name,

                    'partner_id': res.partner_shipping_id.id,

                    'location_id': loc.lot_stock_id.id,

                    'location_dest_id': res.partner_shipping_id.property_stock_customer.id,

                    'picking_type_id':op_type.id,     



Hope this helps

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
mar. 23
2852
3
nov. 24
4553
2
avg. 23
3267
2
jul. 23
3903
3
apr. 23
2376