Skip to Content
Menu
This question has been flagged
2366 Views

Hi ,

i have this code below for creating picking programmatically but the picking is created without the information about product lot !

how i can do that

best regards


     for line in record.lines_ids:
                picking_lines.append((0, 0, {
                    'product_id': line.product_id.id,
                    'lot_id': line.lot_id.id,
                    'product_uom': line.product_uom_id.id,
                    'company_id': self.env.user.company_id.id,
                    'name': line.product_id.name,
                    'id_dd_line': line.id,
                    'product_uom_qty': line.qte * 1.0, }
                                      ))
                packop_lines.append((0, 0, {
                    'product_id': line.product_id.id,
                    'product_uom_id': line.product_uom_id.id,
                    'location_id': self.source_id.id,
                    'location_dest_id': self.destination_id.id,
                    'product_qty': line.qte * 1.0,
                    'pack_lot_ids': pack_lot_ids.append((0, 0, {
                                    'product_id': line.product_id.id,
                                    'lot_id': line.lot_id.id,
                                    'qty_todo': line.qte * 1.0, }))
                }))

        vals = {
                'location_id': self.source_id.id,
                'location_dest_id': self.destination_id.id,
                'min_date': self.date,
                'origin': self.name,
                'picking_type_id': self.env['stock.picking.type'].search([('code', '=', 'internal'),
                                                                          ('default_location_src_id',
                                                                           '=', self.source_id.id)]).id,
                'move_lines': picking_lines,
                'pack_operation_product_ids': packop_lines,
                'move_type': 'direct',
                'priority': '1',
                'company_id': self.env.user.company_id.id,
                'dd_id': self.id,
                'for_delegue': True,
                'state': 'assigned',
            }

            pick_id = self.env['stock.picking'].sudo().create(vals)
            rec = self.env['stock.picking'].browse(pick_id.id)
            rec.action_confirm()
            rec.action_assign() 

Avatar
Discard

Hello Nabil,

Did you found anything,
I'm facing the same challenge, if you have a solution kindly same a man.

Author

@OpenTek
I solved my issue
so i can create filled picking !
what is your challenge ? so i can help you more precisely

Related Posts Replies Views Activity
1
Nov 24
16364
4
Apr 24
170727
0
Dec 23
606
5
Nov 24
217134
1
Dec 22
1692