Review: Needs Fixing
Hardik,

We have found a possible situation that makes your code incorrect.  Imagine you 
have a product with real-time valuation, and you generate stock moves for it.  
Those moves have generated account moves.  At that point, you cannot cancel 
those stock moves, all is fine.  Now, imagine we change the valuation of the 
product, and make it manual.  After that change, we will be able to cancel the 
former stock moves, and that is wrong.

In order to avoid that situation, we propose to link every stock move to its 
generated account move.  More precisely:
- add a many2one field 'account_move_id' on 'stock.move';
- when an account move is created, assign it to the stock move's 
account_move_id;
- to be cancelled, a stock move must have no account_move_id.

For the last item, replacing the condition
    move.product_id.valuation == 'real_time'
by
    move.account_move_id
will make it 100% correct: only the stock moves that have not generated account 
moves can be cancelled.

Thanks,
Raphael

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-usability-Be_able_to_cancel_some_documents-han/+merge/69419
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-usability.

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to