[FIX] stock: Wrong UoM set in the invoice created from incoming shipment...

.../delivery order when user changes the UoM while processing it. (Maintenance Case: 611479)

When changed the UoM of an incoming shipment while processing it, the invoice created after that for that shipment will have wrong UoM and unit price.

Issue can be reproduce if followed the same steps as shown in the video(provided in the issue #1432), http://youtu.be/HGTQnK55vx4.

Currently, the system is considering the UoS of the stock move(related to the processed picking) to set the UoM in the created invoice. Considering UoS for incoming shipment is wrong.
Other point is that, if changed the UoM while processing the picking, the 'unit_price'(hidden field of the related stock moves) for the partial picking will be the calculated based on the UoM of initial move and the qty of the new move. So, this is resulting into wrong unit price in the created invoice.

I have fixed this issue by converting the qty(of partial picking) back to the UoM of initial picking and resetting the UoM of the created partial picking to the UoM of initial picking.

Here's the sample values with wrong result,
1) Incoming Shipment: Product X(cost price: 10 INR for a unit) with 100 Unit(s),
2) Partially receiving it with 2 Ten(s) UoM #2 Ten(s) = 20 Unit(s)
3) Partial pick will be: 2 Ten(s) as UoM(and Unit(s) as UoS) with 'unit_price' 10 INR(WRONG, it should have been 100 INR)
4) Creating invoice of (3) will have 2 Unit(s) and unit_price as 10 INR, (WRONG, it should have been 2 Ten(s) or 20 Unit(s))

Below will be the values after the fix,
1) Incoming Shipment: Product X(cost price: 10 INR for a unit) with 100 Unit(s),
2) Partially receiving it with 2 Ten(s) UoM #2 Ten(s) = 20 Unit(s)
3) Partial pick will be: 20 Unit(s) as UoM with 'unit_price' 10 INR(qty entered for partial picking is converted(2 Ten(s) to 20 Unit(s)) based on the UoM of initial picking(1) and UoM is set same as initial move)
4) Creating invoice of (3) will have 20 Unit(s) and unit_price as 10 INR

Kindly review the fix and share your views on it.

Thanks.