Refactor various views and config, per upstream changes
adding proper integration support for CORE, WooCommerce
This commit is contained in:
		
							parent
							
								
									5481c115ba
								
							
						
					
					
						commit
						34a3ee8f36
					
				
					 4 changed files with 20 additions and 121 deletions
				
			
		| 
						 | 
					@ -1,23 +0,0 @@
 | 
				
			||||||
## -*- coding: utf-8; -*-
 | 
					 | 
				
			||||||
<%inherit file="tailbone:templates/people/view_profile_buefy.mako" />
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<%def name="render_customer_panel_buttons(customer)">
 | 
					 | 
				
			||||||
  <b-button type="is-primary"
 | 
					 | 
				
			||||||
            tag="a" :href="customer.view_corepos_url" target="_blank"
 | 
					 | 
				
			||||||
            :disabled="!customer.view_corepos_url">
 | 
					 | 
				
			||||||
    View in CORE Office
 | 
					 | 
				
			||||||
  </b-button>
 | 
					 | 
				
			||||||
  ${parent.render_customer_panel_buttons(customer)}
 | 
					 | 
				
			||||||
</%def>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<%def name="render_member_panel_buttons(member)">
 | 
					 | 
				
			||||||
  <b-button type="is-primary"
 | 
					 | 
				
			||||||
            tag="a" :href="member.view_corepos_url" target="_blank"
 | 
					 | 
				
			||||||
            :disabled="!member.view_corepos_url">
 | 
					 | 
				
			||||||
    View in CORE Office
 | 
					 | 
				
			||||||
  </b-button>
 | 
					 | 
				
			||||||
  ${parent.render_member_panel_buttons(member)}
 | 
					 | 
				
			||||||
</%def>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
${parent.body()}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,46 +0,0 @@
 | 
				
			||||||
## -*- coding: utf-8; -*-
 | 
					 | 
				
			||||||
<%inherit file="tailbone:templates/products/view.mako" />
 | 
					 | 
				
			||||||
<%namespace name="corepos" file="tailbone_corepos:templates/products/view.mako" />
 | 
					 | 
				
			||||||
<%namespace name="woocommerce" file="tailbone_woocommerce:templates/products/view.mako" />
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<%def name="object_helpers()">
 | 
					 | 
				
			||||||
  ${parent.object_helpers()}
 | 
					 | 
				
			||||||
  ${self.render_xref_helper()}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <div class="object-helper">
 | 
					 | 
				
			||||||
    <h3>Internal Links</h3>
 | 
					 | 
				
			||||||
    <div class="object-helper-content">
 | 
					 | 
				
			||||||
      <ul>
 | 
					 | 
				
			||||||
        % if instance.corepos_id:
 | 
					 | 
				
			||||||
            <li>${h.link_to("View CORE-POS Product", url('corepos.products.view', id=instance.corepos_id))}</li>
 | 
					 | 
				
			||||||
        % endif
 | 
					 | 
				
			||||||
        % if instance.demo_shopfoo_product:
 | 
					 | 
				
			||||||
            <li>${h.link_to("View Shopfoo Product", url('shopfoo.products.view', uuid=instance.demo_shopfoo_product.uuid))}</li>
 | 
					 | 
				
			||||||
        % endif
 | 
					 | 
				
			||||||
        % if instance.woocommerce_cache_product:
 | 
					 | 
				
			||||||
            <li>${h.link_to("View WooCommerce Product", url('woocommerce.products.view', uuid=instance.woocommerce_cache_product.uuid))}</li>
 | 
					 | 
				
			||||||
        % endif
 | 
					 | 
				
			||||||
      </ul>
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
  </div>
 | 
					 | 
				
			||||||
</%def>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<%def name="render_xref_helper()">
 | 
					 | 
				
			||||||
  <div class="object-helper">
 | 
					 | 
				
			||||||
    <h3>Cross-Reference</h3>
 | 
					 | 
				
			||||||
    <div class="object-helper-content buttons">
 | 
					 | 
				
			||||||
      ${corepos.render_xref_button()}
 | 
					 | 
				
			||||||
      ${woocommerce.render_xref_store_button()}
 | 
					 | 
				
			||||||
      ${woocommerce.render_xref_admin_button()}
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
  </div>
 | 
					 | 
				
			||||||
</%def>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<%def name="extra_main_fields(form)">
 | 
					 | 
				
			||||||
  ${parent.extra_main_fields(form)}
 | 
					 | 
				
			||||||
  ${corepos.extra_main_fields_corepos(form)}
 | 
					 | 
				
			||||||
  ${woocommerce.extra_main_fields_woocommerce(form)}
 | 
					 | 
				
			||||||
</%def>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
${parent.body()}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -14,26 +14,26 @@ def includeme(config):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # main table views
 | 
					    # main table views
 | 
				
			||||||
    config.include('tailbone.views.brands')
 | 
					    config.include('tailbone.views.brands')
 | 
				
			||||||
    config.include('tailbone_corepos.views.customers')
 | 
					    config.include('tailbone.views.customers')
 | 
				
			||||||
    config.include('tailbone.views.datasync')
 | 
					    config.include('tailbone.views.datasync')
 | 
				
			||||||
    config.include('tailbone_corepos.views.departments')
 | 
					    config.include('tailbone.views.departments')
 | 
				
			||||||
    config.include('tailbone.views.email')
 | 
					    config.include('tailbone.views.email')
 | 
				
			||||||
    config.include('tailbone.views.employees')
 | 
					    config.include('tailbone.views.employees')
 | 
				
			||||||
    config.include('tailbone.views.families')
 | 
					    config.include('tailbone.views.families')
 | 
				
			||||||
    config.include('tailbone_corepos.views.members')
 | 
					    config.include('tailbone.views.members')
 | 
				
			||||||
    config.include('tailbone.views.messages')
 | 
					    config.include('tailbone.views.messages')
 | 
				
			||||||
    config.include('tailbone_corepos.views.people')
 | 
					    config.include('tailbone.views.people')
 | 
				
			||||||
    config.include('rattail_demo.web.views.products')
 | 
					    config.include('rattail_demo.web.views.products')
 | 
				
			||||||
    config.include('tailbone.views.reportcodes')
 | 
					    config.include('tailbone.views.reportcodes')
 | 
				
			||||||
    config.include('tailbone.views.reports')
 | 
					    config.include('tailbone.views.reports')
 | 
				
			||||||
    config.include('tailbone.views.roles')
 | 
					    config.include('tailbone.views.roles')
 | 
				
			||||||
    config.include('tailbone.views.settings')
 | 
					    config.include('tailbone.views.settings')
 | 
				
			||||||
    config.include('tailbone_corepos.views.stores')
 | 
					    config.include('tailbone.views.stores')
 | 
				
			||||||
    config.include('tailbone_corepos.views.subdepartments')
 | 
					    config.include('tailbone.views.subdepartments')
 | 
				
			||||||
    config.include('tailbone.views.tempmon')
 | 
					    config.include('tailbone.views.tempmon')
 | 
				
			||||||
    config.include('rattail_demo.web.views.upgrades')
 | 
					    config.include('rattail_demo.web.views.upgrades')
 | 
				
			||||||
    config.include('tailbone.views.users')
 | 
					    config.include('tailbone.views.users')
 | 
				
			||||||
    config.include('tailbone_corepos.views.vendors')
 | 
					    config.include('tailbone.views.vendors')
 | 
				
			||||||
    config.include('tailbone.views.uoms')
 | 
					    config.include('tailbone.views.uoms')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # purchasing / receiving
 | 
					    # purchasing / receiving
 | 
				
			||||||
| 
						 | 
					@ -42,12 +42,14 @@ def includeme(config):
 | 
				
			||||||
    config.include('tailbone.views.purchasing')
 | 
					    config.include('tailbone.views.purchasing')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # core-pos views
 | 
					    # core-pos views
 | 
				
			||||||
 | 
					    config.include('tailbone_corepos.views')
 | 
				
			||||||
    config.include('tailbone_corepos.views.corepos')
 | 
					    config.include('tailbone_corepos.views.corepos')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # shopfoo views
 | 
					    # shopfoo views
 | 
				
			||||||
    config.include('rattail_demo.web.views.shopfoo')
 | 
					    config.include('rattail_demo.web.views.shopfoo')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # woocommerce views
 | 
					    # woocommerce views
 | 
				
			||||||
 | 
					    config.include('tailbone_woocommerce.views')
 | 
				
			||||||
    config.include('tailbone_woocommerce.views.woocommerce')
 | 
					    config.include('tailbone_woocommerce.views.woocommerce')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # batch views
 | 
					    # batch views
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,59 +3,25 @@
 | 
				
			||||||
Product views
 | 
					Product views
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from webhelpers2.html import tags
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from tailbone.views import products as base
 | 
					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
 | 
					    Product overrides for online demo
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def configure_form(self, f):
 | 
					    def get_xref_links(self, product):
 | 
				
			||||||
        super(ProductView, self).configure_form(f)
 | 
					        links = super(ProductView, self).get_xref_links(product)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if self.editing:
 | 
					        if product.demo_shopfoo_product:
 | 
				
			||||||
            f.fields = [
 | 
					            url = self.request.route_url('shopfoo.products.view',
 | 
				
			||||||
                'upc',
 | 
					                                         uuid=product.demo_shopfoo_product.uuid)
 | 
				
			||||||
                'item_id',
 | 
					            links.append(tags.link_to("View Shopfoo Product", url))
 | 
				
			||||||
                'brand_uuid',
 | 
					
 | 
				
			||||||
                'description',
 | 
					        return links
 | 
				
			||||||
                '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',
 | 
					 | 
				
			||||||
            ]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def includeme(config):
 | 
					def includeme(config):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue