← Back to team overview

openerp-expert-production team mailing list archive

Stock moves' and pickings' statuses are messed up

 

Hi!
Stock moves and pickings have similar statuses but they behave differently if 
the user handles the move directly or through a picking. 

This is not only a problem because of inconsistency but one picking could have 
it's moves in different states and the picking's unlink() method only verifies 
the picking's state and forces the move to be deleted even if it's done!

Here is a summary of the stock.move's states and how they're handled:
-draft: can be deleted directly (Y) and from a picking (Y)
-waiting, confirmed, assigned: can't be deleted directly (N) but if the picking 
is in auto, confirmed, assigned, it will force the moves to be deleted (Y)
-done: can't be deleted directly (N) and done picking can't be deleted either 
(N)
-cancel: can be deleted directly (Y) but a cancelled picking can't be deleted 
(N)

It's messed up.

My proposal:
-Let only the stock.move decide if it can be deleted or not. It would raise an 
exception if not and that would prevent the picking to be
deleted, too.
-To authorize deleting of cancelled moves, one of these checks should be done 
(don't know which one is the best):
--the user is admin
--it's a company-level setting
--only stock managers can delete cancelled moves

I could come up with a bug report and a patch if you agree this problem should 
be solved.



Follow ups