Allow vendor field to be dropdown, for mobile ordering/receiving
based on config. useful for apps which have very few vendors
This commit is contained in:
parent
19080924d5
commit
145e7f5529
5 changed files with 68 additions and 17 deletions
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2017 Lance Edgar
|
||||
# Copyright © 2010-2019 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -36,6 +36,8 @@ from rattail.db import model, api
|
|||
from rattail.core import Object
|
||||
from rattail.time import localtime
|
||||
|
||||
from webhelpers2.html import tags
|
||||
|
||||
from tailbone.views.purchasing import PurchasingBatchView
|
||||
|
||||
|
||||
|
@ -317,6 +319,17 @@ class OrderingBatchView(PurchasingBatchView):
|
|||
data['index_title'] = self.get_index_title()
|
||||
data['index_url'] = self.get_index_url(mobile=True)
|
||||
data['mode_title'] = self.enum.PURCHASE_BATCH_MODE[mode].capitalize()
|
||||
|
||||
data['vendor_use_autocomplete'] = self.rattail_config.getbool(
|
||||
'rattail', 'vendor.use_autocomplete', default=True)
|
||||
if not data['vendor_use_autocomplete']:
|
||||
vendors = self.Session.query(model.Vendor)\
|
||||
.order_by(model.Vendor.name)
|
||||
options = [(tags.Option(vendor.name, vendor.uuid))
|
||||
for vendor in vendors]
|
||||
options.insert(0, tags.Option("(please choose)", ''))
|
||||
data['vendor_options'] = options
|
||||
|
||||
return self.render_to_response('create', data, mobile=True)
|
||||
|
||||
def configure_mobile_row_form(self, f):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2018 Lance Edgar
|
||||
# Copyright © 2010-2019 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -677,10 +677,23 @@ class ReceivingBatchView(PurchasingBatchView):
|
|||
data['dform'] = form.make_deform_form()
|
||||
data['mode_title'] = self.enum.PURCHASE_BATCH_MODE[mode].capitalize()
|
||||
data['phase'] = phase
|
||||
if phase == 2:
|
||||
|
||||
if phase == 1:
|
||||
data['vendor_use_autocomplete'] = self.rattail_config.getbool(
|
||||
'rattail', 'vendor.use_autocomplete', default=True)
|
||||
if not data['vendor_use_autocomplete']:
|
||||
vendors = self.Session.query(model.Vendor)\
|
||||
.order_by(model.Vendor.name)
|
||||
options = [(tags.Option(vendor.name, vendor.uuid))
|
||||
for vendor in vendors]
|
||||
options.insert(0, tags.Option("(please choose)", ''))
|
||||
data['vendor_options'] = options
|
||||
|
||||
elif phase == 2:
|
||||
purchases = self.eligible_purchases(vendor.uuid, mode=mode)
|
||||
data['purchases'] = [(p['key'], p['display']) for p in purchases['purchases']]
|
||||
data['purchase_order_fieldname'] = self.purchase_order_fieldname
|
||||
|
||||
return self.render_to_response('create', data, mobile=True)
|
||||
|
||||
def make_mobile_receiving_from_po_schema(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue