* Check for (and reduce) overallocated stock when editing build orders.
After a build order is edited, check whether any bom items are now
overallocated to the build, and if they are find appropriate build items to
reduce the quantity of or remove from the build.
Fixes: #3236
* Only trim overallocated stock if requested
Turns the complete with overallocated stock option into a choice, so the
user can reject (default), continue (existing option in the bool), or
now additionally instead choose to have the overallocated stock removed
before the build is completed.
* fix style errors
* Another style fix.
* Add tests for overallocation handling API logic
* Capitalize overallocation options.
It's possible for a part to have purchase price information, but not supplier
pricing (aka unit prices), but the current BOM price display logic will only
show the purchase prices when supplier prices are also available.
It seems reasonable to separate these two pieces of information - even when no
supplier pricing is available, seeing the purchase prices for BOM components is
useful on its own.
* Fix has_complete_bom_pricing logic errors
There are two logic errors in this property method that have been present since
c6fd228.
1) The get_setting method needs to be called on the InventTreeSetting class in
common.models, not on the module itself.
2) You cannot call a property method directly passing an argument in Python, so
the call to has_pricing_info is invalid and always fails. Given that
has_complete_bom_pricing is/was the only user of that property anyway, fix
this by just internalising the logic from that property in the method
directly.
* style nit: use implicit checking for bools
has_complete_bom_pricing is a boolean property, the preferred pythonic style
for if comparisons of this type is not to complete directly to == False, etc
and rely on the implicit truthiness of the type.