Add SQLProduct reference to StockTransaction table

For reference, half of this came from J$'s PR but had to be reran.
Fix tests and, well, real functionality
Merge pull request #4859 from dimagi/transactions-sql-product

Add SQLProduct reference to StockTransaction table