Remove references to deprecated batch handler methods
This commit is contained in:
parent
cb39ca7970
commit
242bcd7603
|
@ -306,7 +306,7 @@ class BatchMasterView(MasterView):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def redirect_after_create(self, batch):
|
def redirect_after_create(self, batch):
|
||||||
if self.handler.requires_prefill(batch):
|
if self.handler.should_populate(batch):
|
||||||
return self.redirect(self.get_action_url('prefill', batch))
|
return self.redirect(self.get_action_url('prefill', batch))
|
||||||
elif self.refresh_after_create:
|
elif self.refresh_after_create:
|
||||||
return self.redirect(self.get_action_url('refresh', batch))
|
return self.redirect(self.get_action_url('refresh', batch))
|
||||||
|
@ -501,7 +501,7 @@ class BatchMasterView(MasterView):
|
||||||
session = RattailSession()
|
session = RattailSession()
|
||||||
batch = session.query(self.model_class).get(batch_uuid)
|
batch = session.query(self.model_class).get(batch_uuid)
|
||||||
try:
|
try:
|
||||||
self.handler.make_initial_rows(batch, progress=progress)
|
self.handler.populate(batch, progress=progress)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
session.rollback()
|
session.rollback()
|
||||||
log.warning("batch pre-fill failed: {}".format(batch), exc_info=True)
|
log.warning("batch pre-fill failed: {}".format(batch), exc_info=True)
|
||||||
|
|
|
@ -494,7 +494,7 @@ class ProductsView(MasterView):
|
||||||
params['created_by'] = user
|
params['created_by'] = user
|
||||||
batch = handler.make_batch(session, **params)
|
batch = handler.make_batch(session, **params)
|
||||||
batch.products = products.with_session(session).all()
|
batch.products = products.with_session(session).all()
|
||||||
handler.make_initial_rows(batch, progress=progress)
|
handler.populate(batch, progress=progress)
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
session.refresh(batch)
|
session.refresh(batch)
|
||||||
|
|
|
@ -943,8 +943,8 @@ class PurchaseBatchView(BatchMasterView):
|
||||||
batch.created_by = self.request.user
|
batch.created_by = self.request.user
|
||||||
kwargs = self.get_batch_kwargs(batch, mobile=True)
|
kwargs = self.get_batch_kwargs(batch, mobile=True)
|
||||||
batch = self.handler.make_batch(self.Session(), **kwargs)
|
batch = self.handler.make_batch(self.Session(), **kwargs)
|
||||||
if self.handler.requires_prefill(batch):
|
if self.handler.should_populate(batch):
|
||||||
self.handler.make_initial_rows(batch)
|
self.handler.populate(batch)
|
||||||
self.request.session.flash("Created new purchasing batch: {}".format(batch))
|
self.request.session.flash("Created new purchasing batch: {}".format(batch))
|
||||||
# TODO: redirect to mobile receiving view etc. instead
|
# TODO: redirect to mobile receiving view etc. instead
|
||||||
return self.redirect(self.request.route_url('purchases.batch.mobile_create'))
|
return self.redirect(self.request.route_url('purchases.batch.mobile_create'))
|
||||||
|
|
Loading…
Reference in a new issue