I've got a Supplier Invoice (SupplierInvoice) parent model that holds a number of orders (SupplierOrder). Right now if the user puts together an invoice via django admin, django checks to see if there are price matches for that Supplier and Product in a cost price table and pulls through the respective fields. This process happens on a custom save method.
What I need to add is code to cover any instances where there is no price match, in which case validation should kick in and warn the user that they have to enter something into the order before committing.
I've tried several variations on custom modelForm 'clean' methods and they kick in before the save method has a chance to look up prices and check first.
Ideally what I want is Django to check the appropriate tables for price matches THEN validate to say there are no matches and one must be entered.
http://dpaste.com/hold/47848/ for the corresponding code.
Thanks for any help - I'm totally stumped!