From ece361a0e69d21bd441061cd02bbaabfec914eab Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 28 Feb 2020 18:12:16 -0600 Subject: [PATCH] Fix basic product editing feature limit which fields are supported --- rattail_demo/web/views/__init__.py | 2 +- rattail_demo/web/views/products.py | 69 ++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 rattail_demo/web/views/products.py diff --git a/rattail_demo/web/views/__init__.py b/rattail_demo/web/views/__init__.py index babf173..536c347 100644 --- a/rattail_demo/web/views/__init__.py +++ b/rattail_demo/web/views/__init__.py @@ -24,7 +24,7 @@ def includeme(config): config.include('tailbone.views.families') config.include('tailbone.views.messages') config.include('rattail_demo.web.views.people') - config.include('tailbone.views.products') + config.include('rattail_demo.web.views.products') config.include('tailbone.views.reportcodes') config.include('tailbone.views.roles') config.include('rattail_demo.web.views.settings') diff --git a/rattail_demo/web/views/products.py b/rattail_demo/web/views/products.py new file mode 100644 index 0000000..0c0ba19 --- /dev/null +++ b/rattail_demo/web/views/products.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +""" +Product views +""" + +from __future__ import unicode_literals, absolute_import + +from tailbone.views import products as base + + +class ProductsView(base.ProductsView): + """ + Product overrides for online demo + """ + + def configure_form(self, f): + super(ProductsView, self).configure_form(f) + + if self.editing: + f.fields = [ + 'upc', + 'brand_uuid', + 'description', + 'unit_size', + 'unit_of_measure', + 'size', + 'pack_size', + 'default_pack', + 'case_size', + 'weighed', + 'department_uuid', + 'subdepartment_uuid', + 'category_uuid', + 'family_uuid', + 'report_code_uuid', + 'regular_price_amount', + 'deposit_link_uuid', + 'tax_uuid', + 'tax1', + 'tax2', + 'tax3', + 'organic', + 'kosher', + 'vegan', + 'vegetarian', + 'gluten_free', + 'sugar_free', + 'discountable', + 'special_order', + 'not_for_sale', + 'ingredients', + 'notes', + 'status', + 'discontinued', + 'deleted', + ] + + +def includeme(config): + + config.add_route('products.autocomplete', '/products/autocomplete') + config.add_view(base.ProductsAutocomplete, route_name='products.autocomplete', + renderer='json', permission='products.list') + + config.add_route('products.print_labels', '/products/labels') + config.add_view(base.print_labels, route_name='products.print_labels', + renderer='json', permission='products.print_labels') + + ProductsView.defaults(config)