Skip to Content
Menu
This question has been flagged

I am not sure I understand what the use of auto_validate field is in stock.move. The only place I find it used is in stock.move.action_done()

        # Downstream move should only be triggered if this move is the last pending upstream move
        other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']),
                                    ('move_dest_id','=',move.move_dest_id.id)], context=context)
        if not other_upstream_move_ids:
            self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
            if move.move_dest_id.state in ('waiting', 'confirmed'):
                self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
                if move.move_dest_id.picking_id:
                    wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
                if move.move_dest_id.auto_validate:
                    self.action_done(cr, uid, [move.move_dest_id.id], context=context)

I'm fuzzy on what happens here. Does anybody know what the condition is that sets the auto_validate field to True?

Avatar
Discard
Best Answer

move_dest_id is another stock.move

You can see the definition of auto_validate in the columns section of stock.move. 'auto_validate': fields.boolean('Auto Validate'),

it is referenced in /procurement/procurement.py - action_confirm(): and /mrp/stock.py - _action_explode()

it makes it unnecessary for the user to manually validate the stock move that is generated by a process.

Avatar
Discard
Author

So if I had moves generated from CSV import or the scheduler would this manual validation step be added then? I'm interested to know the condition that sets this because I am adding a custom module to audit shipments and it might be useful to incorporate auto_validate into this but I don't want to interfere with its normal operation.

Related Posts Replies Views Activity
0
Mar 15
3822
0
Mar 15
3590
1
Mar 15
4054
1
Aug 21
6550
2
Mar 21
4690