Fix context test in Product.get_cost_value

issue3868
review6311002
Use correct grouping when adding to warehouse

issue3843
review11281005