Remove all deprecated use_buefy
logic
also remove some static files no longer used, etc.
This commit is contained in:
parent
01e5eee981
commit
9faaea881d
112 changed files with 2079 additions and 7039 deletions
|
@ -24,12 +24,9 @@
|
|||
Product Views
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
|
||||
import re
|
||||
import logging
|
||||
|
||||
import six
|
||||
import humanize
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import orm
|
||||
|
@ -212,7 +209,6 @@ class ProductView(MasterView):
|
|||
super(ProductView, self).configure_grid(g)
|
||||
app = self.get_rattail_app()
|
||||
model = self.model
|
||||
use_buefy = self.get_use_buefy()
|
||||
|
||||
def join_vendor(q):
|
||||
return q.outerjoin(self.ProductVendorCost,
|
||||
|
@ -257,9 +253,6 @@ class ProductView(MasterView):
|
|||
departments = self.get_departments()
|
||||
department_choices = OrderedDict([('', "(any)")]
|
||||
+ [(d.uuid, d.name) for d in departments])
|
||||
if not use_buefy:
|
||||
department_choices = [tags.Option(name, uuid)
|
||||
for uuid, name in six.iteritems(department_choices)]
|
||||
g.set_filter('department', model.Department.uuid,
|
||||
value_enum=department_choices,
|
||||
verbs=['equal', 'not_equal', 'is_null', 'is_not_null', 'is_any'],
|
||||
|
@ -378,12 +371,9 @@ class ProductView(MasterView):
|
|||
g.set_filter('report_code_name', model.ReportCode.name)
|
||||
|
||||
if self.expose_label_printing and self.has_perm('print_labels'):
|
||||
if use_buefy:
|
||||
g.more_actions.append(self.make_action(
|
||||
'print_label', icon='print', url='#',
|
||||
click_handler='quickLabelPrint(props.row)'))
|
||||
else:
|
||||
g.more_actions.append(grids.GridAction('print_label', icon='print'))
|
||||
g.more_actions.append(self.make_action(
|
||||
'print_label', icon='print', url='#',
|
||||
click_handler='quickLabelPrint(props.row)'))
|
||||
|
||||
g.set_renderer('regular_price', self.render_price)
|
||||
g.set_renderer('on_hand', self.render_on_hand)
|
||||
|
@ -572,10 +562,7 @@ class ProductView(MasterView):
|
|||
if not self.has_perm('versions'):
|
||||
return text
|
||||
|
||||
if self.get_use_buefy():
|
||||
kwargs = {'@click.prevent': 'showPriceHistory_{}()'.format(typ)}
|
||||
else:
|
||||
kwargs = {'id': 'view-{}-price-history'.format(typ)}
|
||||
kwargs = {'@click.prevent': 'showPriceHistory_{}()'.format(typ)}
|
||||
history = tags.link_to("(view history)", '#', **kwargs)
|
||||
if not text:
|
||||
return history
|
||||
|
@ -815,7 +802,7 @@ class ProductView(MasterView):
|
|||
|
||||
if 'upc' in data:
|
||||
if isinstance(data['upc'], GPC):
|
||||
data['upc'] = six.text_type(data['upc'])
|
||||
data['upc'] = str(data['upc'])
|
||||
|
||||
return data
|
||||
|
||||
|
@ -971,9 +958,9 @@ class ProductView(MasterView):
|
|||
if self.request.POST.get('brand_uuid'):
|
||||
brand = self.Session.query(model.Brand).get(self.request.POST['brand_uuid'])
|
||||
if brand:
|
||||
brand_display = six.text_type(brand)
|
||||
brand_display = str(brand)
|
||||
elif self.editing:
|
||||
brand_display = six.text_type(product.brand or '')
|
||||
brand_display = str(product.brand or '')
|
||||
brands_url = self.request.route_url('brands.autocomplete')
|
||||
f.set_widget('brand_uuid', forms.widgets.JQueryAutocompleteWidget(
|
||||
field_display=brand_display, service_url=brands_url))
|
||||
|
@ -1139,11 +1126,11 @@ class ProductView(MasterView):
|
|||
history['price'] = float(price)
|
||||
history['price_display'] = app.render_currency(price)
|
||||
changed = localtime(self.rattail_config, history['changed'], from_utc=True)
|
||||
history['changed'] = six.text_type(changed)
|
||||
history['changed'] = str(changed)
|
||||
history['changed_display_html'] = raw_datetime(self.rattail_config, changed)
|
||||
user = history.pop('changed_by')
|
||||
history['changed_by_uuid'] = user.uuid if user else None
|
||||
history['changed_by_display'] = six.text_type(user or "??")
|
||||
history['changed_by_display'] = str(user or "??")
|
||||
jsdata.append(history)
|
||||
return jsdata
|
||||
|
||||
|
@ -1165,18 +1152,17 @@ class ProductView(MasterView):
|
|||
else:
|
||||
history['cost_display'] = None
|
||||
changed = localtime(self.rattail_config, history['changed'], from_utc=True)
|
||||
history['changed'] = six.text_type(changed)
|
||||
history['changed'] = str(changed)
|
||||
history['changed_display_html'] = raw_datetime(self.rattail_config, changed)
|
||||
user = history.pop('changed_by')
|
||||
history['changed_by_uuid'] = user.uuid
|
||||
history['changed_by_display'] = six.text_type(user)
|
||||
history['changed_by_display'] = str(user)
|
||||
jsdata.append(history)
|
||||
return jsdata
|
||||
|
||||
def template_kwargs_view(self, **kwargs):
|
||||
kwargs = super(ProductView, self).template_kwargs_view(**kwargs)
|
||||
product = kwargs['instance']
|
||||
use_buefy = self.get_use_buefy()
|
||||
|
||||
kwargs['image_url'] = self.products_handler.get_image_url(product)
|
||||
|
||||
|
@ -1184,10 +1170,7 @@ class ProductView(MasterView):
|
|||
if self.rattail_config.versioning_enabled() and self.has_perm('versions'):
|
||||
|
||||
# regular price
|
||||
if use_buefy:
|
||||
data = [] # defer fetching until user asks for it
|
||||
else:
|
||||
data = self.get_regular_price_history(product)
|
||||
data = [] # defer fetching until user asks for it
|
||||
grid = grids.Grid('products.regular_price_history', data,
|
||||
request=self.request,
|
||||
columns=[
|
||||
|
@ -1201,10 +1184,7 @@ class ProductView(MasterView):
|
|||
kwargs['regular_price_history_grid'] = grid
|
||||
|
||||
# current price
|
||||
if use_buefy:
|
||||
data = [] # defer fetching until user asks for it
|
||||
else:
|
||||
data = self.get_current_price_history(product)
|
||||
data = [] # defer fetching until user asks for it
|
||||
grid = grids.Grid('products.current_price_history', data,
|
||||
request=self.request,
|
||||
columns=[
|
||||
|
@ -1222,10 +1202,7 @@ class ProductView(MasterView):
|
|||
kwargs['current_price_history_grid'] = grid
|
||||
|
||||
# suggested price
|
||||
if use_buefy:
|
||||
data = [] # defer fetching until user asks for it
|
||||
else:
|
||||
data = self.get_suggested_price_history(product)
|
||||
data = [] # defer fetching until user asks for it
|
||||
grid = grids.Grid('products.suggested_price_history', data,
|
||||
request=self.request,
|
||||
columns=[
|
||||
|
@ -1239,10 +1216,7 @@ class ProductView(MasterView):
|
|||
kwargs['suggested_price_history_grid'] = grid
|
||||
|
||||
# cost history
|
||||
if use_buefy:
|
||||
data = [] # defer fetching until user asks for it
|
||||
else:
|
||||
data = self.get_cost_history(product)
|
||||
data = [] # defer fetching until user asks for it
|
||||
grid = grids.Grid('products.cost_history', data,
|
||||
request=self.request,
|
||||
columns=[
|
||||
|
@ -1264,9 +1238,8 @@ class ProductView(MasterView):
|
|||
kwargs['costs_label_code'] = "Order Code"
|
||||
kwargs['costs_label_case_size'] = "Case Size"
|
||||
|
||||
if use_buefy:
|
||||
kwargs['vendor_sources'] = self.get_context_vendor_sources(product)
|
||||
kwargs['lookup_codes'] = self.get_context_lookup_codes(product)
|
||||
kwargs['vendor_sources'] = self.get_context_vendor_sources(product)
|
||||
kwargs['lookup_codes'] = self.get_context_lookup_codes(product)
|
||||
|
||||
kwargs['panel_fields'] = self.get_panel_fields(product)
|
||||
|
||||
|
@ -1362,7 +1335,7 @@ class ProductView(MasterView):
|
|||
source['case_size'] = app.render_quantity(cost.case_size)
|
||||
source['case_cost'] = app.render_currency(cost.case_cost)
|
||||
|
||||
text = six.text_type(cost.vendor)
|
||||
text = str(cost.vendor)
|
||||
if link_vendor:
|
||||
url = self.request.route_url('vendors.view', uuid=cost.vendor.uuid)
|
||||
source['vendor'] = tags.link_to(text, url)
|
||||
|
@ -1768,8 +1741,6 @@ class ProductView(MasterView):
|
|||
# TODO: how to properly detect image type?
|
||||
# content_type = 'image/png'
|
||||
content_type = 'image/jpeg'
|
||||
if not six.PY3:
|
||||
content_type = six.binary_type(content_type)
|
||||
self.request.response.content_type = content_type
|
||||
self.request.response.body = product.image.bytes
|
||||
return self.request.response
|
||||
|
@ -1802,7 +1773,7 @@ class ProductView(MasterView):
|
|||
printer.print_labels([({'product': product}, quantity)])
|
||||
except Exception as error:
|
||||
log.warning("error occurred while printing labels", exc_info=True)
|
||||
return {'error': six.text_type(error)}
|
||||
return {'error': str(error)}
|
||||
return {'ok': True}
|
||||
|
||||
def search(self):
|
||||
|
@ -1923,7 +1894,7 @@ class ProductView(MasterView):
|
|||
if product and (not product.deleted or self.request.has_perm('products.view_deleted')):
|
||||
data = {
|
||||
'uuid': product.uuid,
|
||||
'upc': six.text_type(product.upc),
|
||||
'upc': str(product.upc),
|
||||
'upc_pretty': product.upc.pretty(),
|
||||
'full_description': product.full_description,
|
||||
'image_url': pod.get_image_url(self.rattail_config, product.upc),
|
||||
|
@ -2282,7 +2253,7 @@ class PendingProductView(MasterView):
|
|||
g.set_enum('status_code', self.enum.PENDING_PRODUCT_STATUS)
|
||||
g.filters['status_code'].default_active = True
|
||||
g.filters['status_code'].default_verb = 'not_equal'
|
||||
g.filters['status_code'].default_value = six.text_type(self.enum.PENDING_PRODUCT_STATUS_RESOLVED)
|
||||
g.filters['status_code'].default_value = str(self.enum.PENDING_PRODUCT_STATUS_RESOLVED)
|
||||
|
||||
g.set_sort_defaults('created', 'desc')
|
||||
|
||||
|
@ -2317,9 +2288,9 @@ class PendingProductView(MasterView):
|
|||
if self.request.POST.get('brand_uuid'):
|
||||
brand = self.Session.query(model.Brand).get(self.request.POST['brand_uuid'])
|
||||
if brand:
|
||||
brand_display = six.text_type(brand)
|
||||
brand_display = str(brand)
|
||||
elif self.editing:
|
||||
brand_display = six.text_type(pending.brand or '')
|
||||
brand_display = str(pending.brand or '')
|
||||
brands_url = self.request.route_url('brands.autocomplete')
|
||||
f.set_widget('brand_uuid', forms.widgets.JQueryAutocompleteWidget(
|
||||
field_display=brand_display, service_url=brands_url))
|
||||
|
@ -2344,7 +2315,7 @@ class PendingProductView(MasterView):
|
|||
if self.request.POST.get('vendor_uuid'):
|
||||
vendor = self.Session.query(model.Vendor).get(self.request.POST['vendor_uuid'])
|
||||
if vendor:
|
||||
vendor_display = six.text_type(vendor)
|
||||
vendor_display = str(vendor)
|
||||
f.set_widget('vendor_uuid', forms.widgets.JQueryAutocompleteWidget(
|
||||
field_display=vendor_display,
|
||||
service_url=self.request.route_url('vendors.autocomplete')))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue