odoo/odoo — pull request #2510 by rvalyi (2014-09-18 09:21:52+00:00)
Title: stock: fix get_code_from_locs

cc @jco-odoo

a stock.move with destination production or inventory loss, view or transfer with always have usage != 'internal'.
So today these moves automatically get a type "outgoing" while in fact they are obviously internal, like for an internal reservation picking such as explained here https://github.com/odoo/odoo/issues/2111#issuecomment-56007328

The same goes with the origin of the move if it is production or inventory loss, view or transfer and today it wrongly get a type "incoming".

Eventually further logic could be involved to check if some view location belongs to customer or supplier or if a production location would be in a different warehouse. But I would say, until you implement these sophisticated checks, I think my code behaves much more correctly than what we have currently for the common cases.