Trying to use "group by" in the product margins menu creates a traceback with a keyError. The problem is that the function stores a recordset in the dictionary and then tries to get it back with an integer. This commit solves the problem by storing the product id in the dictionary instead of the product itself.