Tweak display; let error bubble when writing invoice export file
This commit is contained in:
parent
7384bd1fea
commit
9e0d2dc7e9
|
@ -29,7 +29,6 @@ import logging
|
|||
from rattail_quickbooks.db.model import (QuickbooksExportableInvoice,
|
||||
QuickbooksExportableInvoiceDistribution,
|
||||
QuickbooksInvoiceExport)
|
||||
from rattail.util import simple_error
|
||||
|
||||
import colander
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
|
@ -82,6 +81,8 @@ class ExportableInvoiceView(MasterView):
|
|||
'invoice_number',
|
||||
'invoice_date',
|
||||
'invoice_total',
|
||||
'shipping_amount',
|
||||
'supplies_amount',
|
||||
'quickbooks_vendor_name',
|
||||
'quickbooks_vendor_terms',
|
||||
'quickbooks_vendor_bank_account',
|
||||
|
@ -244,7 +245,8 @@ class ExportableInvoiceView(MasterView):
|
|||
g.set_type('calculated_amount', 'currency')
|
||||
|
||||
# status
|
||||
g.set_enum('status_code', model.QuickbooksExportableInvoiceDistribution.STATUS)
|
||||
g.set_renderer('status_code', self.make_status_renderer(
|
||||
model.QuickbooksExportableInvoiceDistribution.STATUS))
|
||||
|
||||
def row_grid_extra_class(self, dist, i):
|
||||
if dist.status_code in (dist.STATUS_DEPT_IGNORED,
|
||||
|
@ -384,16 +386,7 @@ class ExportableInvoiceView(MasterView):
|
|||
|
||||
path = export.filepath(self.rattail_config, filename=export.filename,
|
||||
makedirs=True)
|
||||
|
||||
try:
|
||||
self.write_invoice_export_file(export, path, invoices)
|
||||
|
||||
except Exception as error:
|
||||
log.warning("failed to write invoice export file for %s", export.uuid,
|
||||
exc_info=True)
|
||||
self.request.session.flash("Failed to write export file: {}".format(
|
||||
simple_error(error)), 'error')
|
||||
|
||||
self.write_invoice_export_file(export, path, invoices)
|
||||
return export
|
||||
|
||||
def write_invoice_export_file(self, export, path, invoices, progress=None):
|
||||
|
|
Loading…
Reference in a new issue