Refactor various views and config, per upstream changes

adding proper integration support for CORE, WooCommerce
This commit is contained in:
Lance Edgar 2022-12-10 09:21:42 -06:00
parent 5481c115ba
commit 34a3ee8f36
4 changed files with 20 additions and 121 deletions

View file

@ -3,59 +3,25 @@
Product views
"""
from webhelpers2.html import tags
from tailbone.views import products as base
from tailbone_corepos.views import products as corepos_base
from tailbone_woocommerce.views import products as woocommerce_base
class ProductView(corepos_base.ProductView, woocommerce_base.ProductView):
class ProductView(base.ProductView):
"""
Product overrides for online demo
"""
def configure_form(self, f):
super(ProductView, self).configure_form(f)
def get_xref_links(self, product):
links = super(ProductView, self).get_xref_links(product)
if self.editing:
f.fields = [
'upc',
'item_id',
'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',
'corepos_id',
]
if product.demo_shopfoo_product:
url = self.request.route_url('shopfoo.products.view',
uuid=product.demo_shopfoo_product.uuid)
links.append(tags.link_to("View Shopfoo Product", url))
return links
def includeme(config):