From e5ffe3025ba52d40b8b0da06b97ebcfac9538220 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 18 May 2018 17:21:01 -0500 Subject: [PATCH] Set received date for new truck dump batches, show when choosing parent --- tailbone/views/purchasing/receiving.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tailbone/views/purchasing/receiving.py b/tailbone/views/purchasing/receiving.py index 55e7d60c..6c754df8 100644 --- a/tailbone/views/purchasing/receiving.py +++ b/tailbone/views/purchasing/receiving.py @@ -34,6 +34,7 @@ import sqlalchemy as sa from rattail import pod from rattail.db import model, api from rattail.gpc import GPC +from rattail.time import localtime from rattail.util import pretty_quantity, prettify 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.executed == None)\ .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)")) f.set_widget('truck_dump_batch_uuid', forms.widgets.JQuerySelectWidget(values=batch_values)) f.set_label('truck_dump_batch_uuid', "Truck Dump Parent") @@ -421,6 +423,7 @@ class ReceivingBatchView(PurchasingBatchView): batch.truck_dump = True batch.vendor = self.Session.merge(form.validated['vendor']) batch.created_by = self.request.user + batch.date_received = localtime(self.rattail_config).date() kwargs = self.get_batch_kwargs(batch, mobile=True) batch = self.handler.make_batch(self.Session(), **kwargs) return self.redirect(self.request.route_url('mobile.receiving.view', uuid=batch.uuid))