automatically recompute consumption in StockStates when the settings change

http://manage.dimagi.com/default.asp?127624

probably easiest read commit by commit, though is pretty simple.

is not dependent on https://github.com/dimagi/casexml/pull/239/ but will be made faster by it.