fix mrp calculation by use of low level code

Fixes #3626 by generating a low level code to be used when calculating reorder rules.

Although the problem exists with 8.0 (see issue for current and expected behavior), the solution requires data model changes so the PR is on master with the hope that it will be accepted and then merged into 8.0.