Wrap up initial vendor catalog batch support etc.
* Adds the ability to delete all batch rows matching current query. * Refactors some progress factory args. * If batch initialization fails, don't persist batch.
This commit is contained in:
parent
c28a6b2e09
commit
16be06821a
4 changed files with 65 additions and 9 deletions
9
tailbone/views/vendors/catalogs.py
vendored
9
tailbone/views/vendors/catalogs.py
vendored
|
@ -26,6 +26,8 @@ Views for maintaining vendor catalogs
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
|
||||
from rattail.db import model
|
||||
from rattail.db.api import get_setting, get_vendor
|
||||
from rattail.db.batch.vendorcatalog import VendorCatalog, VendorCatalogRow
|
||||
|
@ -129,7 +131,12 @@ class VendorCatalogCrud(FileBatchCrud):
|
|||
|
||||
def init_batch(self, batch):
|
||||
parser = require_catalog_parser(batch.parser_key)
|
||||
batch.vendor = get_vendor(Session, parser.vendor_key)
|
||||
vendor = get_vendor(Session, parser.vendor_key)
|
||||
if not vendor:
|
||||
self.request.session.flash("No vendor setting found in database for key: {0}".format(parser.vendor_key))
|
||||
return False
|
||||
batch.vendor = vendor
|
||||
return True
|
||||
|
||||
|
||||
class VendorCatalogRowGrid(BatchRowGrid):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue