Misc. improvements for ordering batches, purchases
also we now show handler's description when executing batch
This commit is contained in:
parent
e1e3301fc1
commit
fac00e6ecd
8 changed files with 77 additions and 34 deletions
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -155,9 +155,11 @@ class OrderingBatchView(PurchasingBatchView):
|
|||
|
||||
def configure_form(self, f):
|
||||
super(OrderingBatchView, self).configure_form(f)
|
||||
batch = f.model_instance
|
||||
|
||||
# purchase
|
||||
f.remove_field('purchase')
|
||||
if self.creating or not batch.executed or not batch.purchase:
|
||||
f.remove_field('purchase')
|
||||
|
||||
def get_batch_kwargs(self, batch, mobile=False):
|
||||
kwargs = super(OrderingBatchView, self).get_batch_kwargs(batch, mobile=mobile)
|
||||
|
@ -468,6 +470,11 @@ class OrderingBatchView(PurchasingBatchView):
|
|||
|
||||
return self.file_response(path)
|
||||
|
||||
def get_execute_success_url(self, batch, result, **kwargs):
|
||||
if isinstance(result, model.Purchase):
|
||||
return self.request.route_url('purchases.view', uuid=result.uuid)
|
||||
return super(OrderingBatchView, self).get_execute_success_url(batch, result, **kwargs)
|
||||
|
||||
@classmethod
|
||||
def _ordering_defaults(cls, config):
|
||||
route_prefix = cls.get_route_prefix()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue