Fix vendor invoice validation bug.
If user provided a PO number but no parser, an error was raised.
This commit is contained in:
parent
366572e0a7
commit
8a21fe7cfc
5
tailbone/views/vendors/invoices.py
vendored
5
tailbone/views/vendors/invoices.py
vendored
|
@ -110,7 +110,10 @@ class VendorInvoiceCrud(FileBatchCrud):
|
|||
Let the invoice handler in effect determine if the user-provided
|
||||
purchase order number is valid.
|
||||
"""
|
||||
parser = require_invoice_parser(field.parent.parser_key.value)
|
||||
parser_key = field.parent.parser_key.value
|
||||
if not parser_key:
|
||||
raise formalchemy.ValidationError("Cannot validate PO number until File Type is chosen")
|
||||
parser = require_invoice_parser(parser_key)
|
||||
vendor = get_vendor(Session(), parser.vendor_key)
|
||||
try:
|
||||
self.handler.validate_po_number(value, vendor)
|
||||
|
|
Loading…
Reference in a new issue