How to change average cost lot with code

SUGGESTED

Hi everybody.

I need found system to update average cost lot without Miscelaneos Receipt /Miscelaneos Issue. For example:

I have product A with 100 units of lot LOT1, and cost is 10. This stock I create with an Purchase receipt.

Now, i create a service document, without units, but with value, for example 10.

I can update average cost with 20 (10+10) of LOT1 ? I knows option Value Change, but i don't know if its simple to create this Value change with code...

Any idea?

Very thanks!