Set received date for new truck dump batches, show when choosing parent
This commit is contained in:
parent
cd7922f204
commit
e5ffe3025b
|
@ -34,6 +34,7 @@ import sqlalchemy as sa
|
||||||
from rattail import pod
|
from rattail import pod
|
||||||
from rattail.db import model, api
|
from rattail.db import model, api
|
||||||
from rattail.gpc import GPC
|
from rattail.gpc import GPC
|
||||||
|
from rattail.time import localtime
|
||||||
from rattail.util import pretty_quantity, prettify
|
from rattail.util import pretty_quantity, prettify
|
||||||
from rattail.vendors.invoices import iter_invoice_parsers, require_invoice_parser
|
from rattail.vendors.invoices import iter_invoice_parsers, require_invoice_parser
|
||||||
|
|
||||||
|
@ -271,7 +272,8 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
.filter(model.PurchaseBatch.complete == True)\
|
.filter(model.PurchaseBatch.complete == True)\
|
||||||
.filter(model.PurchaseBatch.executed == None)\
|
.filter(model.PurchaseBatch.executed == None)\
|
||||||
.order_by(model.PurchaseBatch.id)
|
.order_by(model.PurchaseBatch.id)
|
||||||
batch_values = [(b.uuid, six.text_type(b)) for b in batches]
|
batch_values = [(b.uuid, "({}) {}, {}".format(b.id_str, b.date_received, b.vendor))
|
||||||
|
for b in batches]
|
||||||
batch_values.insert(0, ('', "(please choose)"))
|
batch_values.insert(0, ('', "(please choose)"))
|
||||||
f.set_widget('truck_dump_batch_uuid', forms.widgets.JQuerySelectWidget(values=batch_values))
|
f.set_widget('truck_dump_batch_uuid', forms.widgets.JQuerySelectWidget(values=batch_values))
|
||||||
f.set_label('truck_dump_batch_uuid', "Truck Dump Parent")
|
f.set_label('truck_dump_batch_uuid', "Truck Dump Parent")
|
||||||
|
@ -421,6 +423,7 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
batch.truck_dump = True
|
batch.truck_dump = True
|
||||||
batch.vendor = self.Session.merge(form.validated['vendor'])
|
batch.vendor = self.Session.merge(form.validated['vendor'])
|
||||||
batch.created_by = self.request.user
|
batch.created_by = self.request.user
|
||||||
|
batch.date_received = localtime(self.rattail_config).date()
|
||||||
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)
|
||||||
return self.redirect(self.request.route_url('mobile.receiving.view', uuid=batch.uuid))
|
return self.redirect(self.request.route_url('mobile.receiving.view', uuid=batch.uuid))
|
||||||
|
|
Loading…
Reference in a new issue