Initial commit; with views copied from rattail-demo project
This commit is contained in:
		
						commit
						a04e8359b9
					
				
					 21 changed files with 1729 additions and 0 deletions
				
			
		
							
								
								
									
										38
									
								
								tailbone_corepos/views/corepos/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								tailbone_corepos/views/corepos/__init__.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE POS views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    config.include('tailbone_corepos.views.corepos.departments')
 | 
			
		||||
    config.include('tailbone_corepos.views.corepos.subdepartments')
 | 
			
		||||
    config.include('tailbone_corepos.views.corepos.vendors')
 | 
			
		||||
    config.include('tailbone_corepos.views.corepos.products')
 | 
			
		||||
    config.include('tailbone_corepos.views.corepos.members')
 | 
			
		||||
    config.include('tailbone_corepos.views.corepos.customers')
 | 
			
		||||
    config.include('tailbone_corepos.views.corepos.employees')
 | 
			
		||||
    config.include('tailbone_corepos.views.corepos.transactions')
 | 
			
		||||
							
								
								
									
										92
									
								
								tailbone_corepos/views/corepos/customers.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								tailbone_corepos/views/corepos/customers.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,92 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE POS customer views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from corepos.db import model as corepos
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class CustomerView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Base class for customer views.
 | 
			
		||||
    """
 | 
			
		||||
    model_class = corepos.Customer
 | 
			
		||||
    model_title = "CORE-POS Customer"
 | 
			
		||||
    url_prefix = '/core-pos/customers'
 | 
			
		||||
    route_prefix = 'corepos.customers'
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'id': "ID",
 | 
			
		||||
        'CardNo': "Card No.",
 | 
			
		||||
        'personNum': "Person No.",
 | 
			
		||||
        'LastName': "Last Name",
 | 
			
		||||
        'FirstName': "First Name",
 | 
			
		||||
        'CashBack': "Cash Back",
 | 
			
		||||
        'MemDiscountLimit': "Member Discount Limit",
 | 
			
		||||
        'ChargeLimit': "Charge Limit",
 | 
			
		||||
        'ChargeOk': "Charge OK",
 | 
			
		||||
        'WriteChecks': "Write Checks",
 | 
			
		||||
        'StoreCoupons': "Store Coupons",
 | 
			
		||||
        'memType': "Member Type No.",
 | 
			
		||||
        'NumberOfChecks': "Number of Checks",
 | 
			
		||||
        'memCoupons': "Member Coupons",
 | 
			
		||||
        'blueLine': "Blue Line",
 | 
			
		||||
        'LastChange': "Last Change",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    grid_columns = [
 | 
			
		||||
        'CardNo',
 | 
			
		||||
        'FirstName',
 | 
			
		||||
        'LastName',
 | 
			
		||||
        'ChargeOk',
 | 
			
		||||
        'ChargeLimit',
 | 
			
		||||
        'Balance',
 | 
			
		||||
        'WriteChecks',
 | 
			
		||||
        'Purchases',
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
        super(CustomerView, self).configure_grid(g)
 | 
			
		||||
 | 
			
		||||
        g.filters['FirstName'].default_active = True
 | 
			
		||||
        g.filters['FirstName'].default_verb = 'contains'
 | 
			
		||||
 | 
			
		||||
        g.filters['LastName'].default_active = True
 | 
			
		||||
        g.filters['LastName'].default_verb = 'contains'
 | 
			
		||||
 | 
			
		||||
        g.set_type('ChargeLimit', 'currency')
 | 
			
		||||
        g.set_type('Balance', 'currency')
 | 
			
		||||
        g.set_type('Purchases', 'currency')
 | 
			
		||||
 | 
			
		||||
        g.set_sort_defaults('CardNo')
 | 
			
		||||
 | 
			
		||||
        g.set_link('CardNo')
 | 
			
		||||
        g.set_link('FirstName')
 | 
			
		||||
        g.set_link('LastName')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    CustomerView.defaults(config)
 | 
			
		||||
							
								
								
									
										89
									
								
								tailbone_corepos/views/corepos/departments.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										89
									
								
								tailbone_corepos/views/corepos/departments.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,89 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE-POS department views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from corepos.db import model as corepos
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DepartmentView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Base class for department views.
 | 
			
		||||
    """
 | 
			
		||||
    model_class = corepos.Department
 | 
			
		||||
    model_title = "CORE-POS Department"
 | 
			
		||||
    url_prefix = '/core-pos/departments'
 | 
			
		||||
    route_prefix = 'corepos.departments'
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'dept_no': "Number",
 | 
			
		||||
        'dept_name': "Name",
 | 
			
		||||
        'dept_tax': "Tax",
 | 
			
		||||
        'dept_fs': "FS",
 | 
			
		||||
        'dept_limit': "Limit",
 | 
			
		||||
        'dept_minimum': "Minimum",
 | 
			
		||||
        'dept_discount': "Discount",
 | 
			
		||||
        'dept_see_id': "See ID",
 | 
			
		||||
        'modifiedby': "Modified by",
 | 
			
		||||
        'salesCode': "Sales Code",
 | 
			
		||||
        'memberOnly': "Member Only",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    grid_columns = [
 | 
			
		||||
        'dept_no',
 | 
			
		||||
        'dept_name',
 | 
			
		||||
        'dept_tax',
 | 
			
		||||
        'dept_fs',
 | 
			
		||||
        'dept_limit',
 | 
			
		||||
        'dept_minimum',
 | 
			
		||||
        'dept_discount',
 | 
			
		||||
        'dept_see_id',
 | 
			
		||||
        'modified',
 | 
			
		||||
        'modifiedby',
 | 
			
		||||
        'margin',
 | 
			
		||||
        'salesCode',
 | 
			
		||||
        'memberOnly',
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
        super(DepartmentView, self).configure_grid(g)
 | 
			
		||||
 | 
			
		||||
        g.filters['dept_no'].default_active = True
 | 
			
		||||
        g.filters['dept_no'].default_verb = 'equal'
 | 
			
		||||
 | 
			
		||||
        g.filters['dept_name'].default_active = True
 | 
			
		||||
        g.filters['dept_name'].default_verb = 'contains'
 | 
			
		||||
 | 
			
		||||
        g.set_type('modified', 'datetime_local')
 | 
			
		||||
 | 
			
		||||
        g.set_sort_defaults('dept_no')
 | 
			
		||||
 | 
			
		||||
        g.set_link('dept_no')
 | 
			
		||||
        g.set_link('dept_name')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    DepartmentView.defaults(config)
 | 
			
		||||
							
								
								
									
										87
									
								
								tailbone_corepos/views/corepos/employees.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								tailbone_corepos/views/corepos/employees.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,87 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE-POS employee views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from corepos.db import model as corepos
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class EmployeeView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Base class for employee views.
 | 
			
		||||
    """
 | 
			
		||||
    model_class = corepos.Employee
 | 
			
		||||
    model_title = "CORE-POS Employee"
 | 
			
		||||
    url_prefix = '/core-pos/employees'
 | 
			
		||||
    route_prefix = 'corepos.employees'
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'emp_no': "Number",
 | 
			
		||||
        'CashierPassword': "Cashier Password",
 | 
			
		||||
        'AdminPassword': "Admin Password",
 | 
			
		||||
        'FirstName': "First Name",
 | 
			
		||||
        'LastName': "Last Name",
 | 
			
		||||
        'JobTitle': "Job Title",
 | 
			
		||||
        'EmpActive': "Active",
 | 
			
		||||
        'frontendsecurity': "Frontend Security",
 | 
			
		||||
        'backendsecurity': "Backend Security",
 | 
			
		||||
        'birthdate': "Birth Date",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    grid_columns = [
 | 
			
		||||
        'emp_no',
 | 
			
		||||
        'FirstName',
 | 
			
		||||
        'LastName',
 | 
			
		||||
        'JobTitle',
 | 
			
		||||
        'EmpActive',
 | 
			
		||||
        'birthdate',
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
        super(EmployeeView, self).configure_grid(g)
 | 
			
		||||
 | 
			
		||||
        g.filters['EmpActive'].default_active = True
 | 
			
		||||
        g.filters['EmpActive'].default_verb = 'is_true'
 | 
			
		||||
 | 
			
		||||
        g.filters['FirstName'].default_active = True
 | 
			
		||||
        g.filters['FirstName'].default_verb = 'contains'
 | 
			
		||||
 | 
			
		||||
        g.filters['LastName'].default_active = True
 | 
			
		||||
        g.filters['LastName'].default_verb = 'contains'
 | 
			
		||||
 | 
			
		||||
        g.set_sort_defaults('emp_no')
 | 
			
		||||
 | 
			
		||||
        g.set_link('emp_no')
 | 
			
		||||
        g.set_link('FirstName')
 | 
			
		||||
        g.set_link('LastName')
 | 
			
		||||
 | 
			
		||||
    def grid_extra_class(self, employee, i):
 | 
			
		||||
        if not employee.EmpActive:
 | 
			
		||||
            return 'warning'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    EmployeeView.defaults(config)
 | 
			
		||||
							
								
								
									
										63
									
								
								tailbone_corepos/views/corepos/master.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								tailbone_corepos/views/corepos/master.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,63 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE POS master view
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
# import six
 | 
			
		||||
 | 
			
		||||
# from corepos.util import catapult_time
 | 
			
		||||
 | 
			
		||||
# from rattail.time import localtime
 | 
			
		||||
# from rattail.util import NOTSET
 | 
			
		||||
 | 
			
		||||
from tailbone.views import MasterView
 | 
			
		||||
# from tailbone.util import raw_datetime
 | 
			
		||||
from tailbone_corepos.db import CoreOfficeSession
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class CoreOfficeMasterView(MasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Master base class for Catapult views
 | 
			
		||||
    """
 | 
			
		||||
    Session = CoreOfficeSession
 | 
			
		||||
    # model_key = 'pk'
 | 
			
		||||
    creatable = False
 | 
			
		||||
    editable = False
 | 
			
		||||
    deletable = False
 | 
			
		||||
 | 
			
		||||
    # # TODO: would be nice to find a way around this somehow
 | 
			
		||||
    # # must encode all search values as utf-8
 | 
			
		||||
    # use_byte_string_filters = True
 | 
			
		||||
 | 
			
		||||
    # def get_action_route_kwargs(self, row):
 | 
			
		||||
    #     return {'pk': six.text_type(row.pk)}
 | 
			
		||||
 | 
			
		||||
    # def render_catapult_datetime(self, record, field, value=NOTSET):
 | 
			
		||||
    #     if value is NOTSET:
 | 
			
		||||
    #         value = getattr(record, field)
 | 
			
		||||
    #     if not value:
 | 
			
		||||
    #         return ""
 | 
			
		||||
    #     value = catapult_time(value)
 | 
			
		||||
    #     value = localtime(self.rattail_config, value)
 | 
			
		||||
    #     return raw_datetime(self.rattail_config, value)
 | 
			
		||||
							
								
								
									
										68
									
								
								tailbone_corepos/views/corepos/members.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								tailbone_corepos/views/corepos/members.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,68 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE-POS member views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from corepos.db import model as corepos
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MemberTypeView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Master view for member types
 | 
			
		||||
    """
 | 
			
		||||
    model_class = corepos.MemberType
 | 
			
		||||
    model_title = "CORE-POS Member Type"
 | 
			
		||||
    url_prefix = '/core-pos/member-types'
 | 
			
		||||
    route_prefix = 'corepos.member_types'
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'memtype': "Type",
 | 
			
		||||
        'memDesc': "Description",
 | 
			
		||||
        'custdataType': "Cust. Data Type",
 | 
			
		||||
        'ssi': "SSI",
 | 
			
		||||
        'salesCode': "Sales Code",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
        super(MemberTypeView, self).configure_grid(g)
 | 
			
		||||
 | 
			
		||||
        g.set_link('memtype')
 | 
			
		||||
        g.set_link('memDesc')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MemberView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Master view for members
 | 
			
		||||
    """
 | 
			
		||||
    model_class = corepos.MemberInfo
 | 
			
		||||
    model_title = "CORE-POS Member"
 | 
			
		||||
    url_prefix = '/core-pos/members'
 | 
			
		||||
    route_prefix = 'corepos.members'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    MemberTypeView.defaults(config)
 | 
			
		||||
    MemberView.defaults(config)
 | 
			
		||||
							
								
								
									
										113
									
								
								tailbone_corepos/views/corepos/products.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								tailbone_corepos/views/corepos/products.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,113 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE-POS product views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from corepos.db import model as corepos
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ProductView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Base class for product views.
 | 
			
		||||
    """
 | 
			
		||||
    model_class = corepos.Product
 | 
			
		||||
    model_title = "CORE-POS Product"
 | 
			
		||||
    url_prefix = '/core-pos/products'
 | 
			
		||||
    route_prefix = 'corepos.products'
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'id': "ID",
 | 
			
		||||
        'upc': "UPC",
 | 
			
		||||
        'pricemethod': "Price Method",
 | 
			
		||||
        'groupprice': "Group Price",
 | 
			
		||||
        'specialpricemethod': "Special Price Method",
 | 
			
		||||
        'specialgroupprice': "Special Group Price",
 | 
			
		||||
        'specialquantity': "Special Quantity",
 | 
			
		||||
        'dept_no': "Dept. No.",
 | 
			
		||||
        'foodstamp': "Food Stamp",
 | 
			
		||||
        'scaleprice': "Scale Price",
 | 
			
		||||
        'mixmatchcode': "Mix Match Code",
 | 
			
		||||
        'tareweight': "Tare Weight",
 | 
			
		||||
        'discounttype': "Discount Type",
 | 
			
		||||
        'unitofmeasure': "Unit of Measure",
 | 
			
		||||
        'qttyEnforced': "Qty. Enforced",
 | 
			
		||||
        'idEnforced': "ID Enforced",
 | 
			
		||||
        'inUse': "In Use",
 | 
			
		||||
        'numflag': "Num. Flag",
 | 
			
		||||
        'subdept': "Subdept. No.",
 | 
			
		||||
        'default_vendor_id': "Default Vendor ID",
 | 
			
		||||
        'current_origin_id': "Current Origin ID",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    grid_columns = [
 | 
			
		||||
        'upc',
 | 
			
		||||
        'brand',
 | 
			
		||||
        'description',
 | 
			
		||||
        'size',
 | 
			
		||||
        'department',
 | 
			
		||||
        'vendor',
 | 
			
		||||
        'normal_price',
 | 
			
		||||
        'cost',
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
        super(ProductView, self).configure_grid(g)
 | 
			
		||||
 | 
			
		||||
        g.set_joiner('department', lambda q: q.outerjoin(corepos.Department))
 | 
			
		||||
        g.set_sorter('department', corepos.Department.dept_name)
 | 
			
		||||
 | 
			
		||||
        g.set_joiner('vendor', lambda q: q.outerjoin(corepos.Vendor))
 | 
			
		||||
        g.set_sorter('vendor', corepos.Vendor.vendorName)
 | 
			
		||||
 | 
			
		||||
        g.filters['upc'].default_active = True
 | 
			
		||||
        g.filters['upc'].default_verb = 'equal'
 | 
			
		||||
 | 
			
		||||
        g.set_type('cost', 'currency')
 | 
			
		||||
        g.set_type('normal_price', 'currency')
 | 
			
		||||
 | 
			
		||||
        g.set_sort_defaults('upc')
 | 
			
		||||
 | 
			
		||||
        g.set_link('upc')
 | 
			
		||||
        g.set_link('brand')
 | 
			
		||||
        g.set_link('description')
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
        super(ProductView, self).configure_form(f)
 | 
			
		||||
 | 
			
		||||
        f.set_type('start_date', 'datetime_local')
 | 
			
		||||
        f.set_type('end_date', 'datetime_local')
 | 
			
		||||
        f.set_type('modified', 'datetime_local')
 | 
			
		||||
 | 
			
		||||
        f.set_type('normal_price', 'currency')
 | 
			
		||||
        f.set_type('groupprice', 'currency')
 | 
			
		||||
        f.set_type('special_price', 'currency')
 | 
			
		||||
        f.set_type('specialgroupprice', 'currency')
 | 
			
		||||
        f.set_type('cost', 'currency')
 | 
			
		||||
        f.set_type('deposit', 'currency')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    ProductView.defaults(config)
 | 
			
		||||
							
								
								
									
										55
									
								
								tailbone_corepos/views/corepos/subdepartments.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								tailbone_corepos/views/corepos/subdepartments.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,55 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE-POS subdepartment views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from corepos.db import model as corepos
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class SubdepartmentView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Base class for subdepartment views.
 | 
			
		||||
    """
 | 
			
		||||
    model_class = corepos.Subdepartment
 | 
			
		||||
    model_title = "CORE-POS Subdepartment"
 | 
			
		||||
    url_prefix = '/core-pos/subdepartments'
 | 
			
		||||
    route_prefix = 'corepos.subdepartments'
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'subdept_no': "Number",
 | 
			
		||||
        'subdept_name': "Name",
 | 
			
		||||
        'dept_ID': "Dept. No.",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    grid_columns = [
 | 
			
		||||
        'subdept_no',
 | 
			
		||||
        'subdept_name',
 | 
			
		||||
        'department',
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    SubdepartmentView.defaults(config)
 | 
			
		||||
							
								
								
									
										122
									
								
								tailbone_corepos/views/corepos/transactions.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								tailbone_corepos/views/corepos/transactions.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,122 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE-POS transaction views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from corepos.trans.db import model as coretrans
 | 
			
		||||
 | 
			
		||||
from rattail_corepos.corepos.importing.square import FromSquareToCoreTrans
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
from tailbone_corepos.db import CoreTransSession
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TransactionDetailView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Master view for transaction details.
 | 
			
		||||
    """
 | 
			
		||||
    Session = CoreTransSession
 | 
			
		||||
    model_class = coretrans.TransactionDetail
 | 
			
		||||
    model_title = "CORE-POS Transaction Detail"
 | 
			
		||||
    url_prefix = '/corepos/transaction-details'
 | 
			
		||||
    route_prefix = 'corepos.transaction_details'
 | 
			
		||||
    deletable = True
 | 
			
		||||
    bulk_deletable = True
 | 
			
		||||
    supports_import_batch_from_file = True
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'store_row_id': "Store Row ID",
 | 
			
		||||
        'store_id': "Store ID",
 | 
			
		||||
        'pos_row_id': "POS Row ID",
 | 
			
		||||
        'transaction_id': "Transaction ID",
 | 
			
		||||
        'upc': "UPC",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    grid_columns = [
 | 
			
		||||
        'date_time',
 | 
			
		||||
        'register_number',
 | 
			
		||||
        'transaction_number',
 | 
			
		||||
        'card_number',
 | 
			
		||||
        'upc',
 | 
			
		||||
        'department_number',
 | 
			
		||||
        'description',
 | 
			
		||||
        'quantity',
 | 
			
		||||
        'unit_price',
 | 
			
		||||
        'discount',
 | 
			
		||||
        'total',
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def get_bulk_delete_session(self):
 | 
			
		||||
        from corepos.trans.db import Session as CoreTransSession
 | 
			
		||||
 | 
			
		||||
        return CoreTransSession()
 | 
			
		||||
 | 
			
		||||
    def configure_grid(self, g):
 | 
			
		||||
        super(TransactionDetailView, self).configure_grid(g)
 | 
			
		||||
 | 
			
		||||
        g.set_type('date_time', 'datetime_local')
 | 
			
		||||
        g.set_type('quantity', 'quantity')
 | 
			
		||||
        g.set_type('unit_price', 'currency')
 | 
			
		||||
        g.set_type('discount', 'currency')
 | 
			
		||||
        g.set_type('total', 'currency')
 | 
			
		||||
 | 
			
		||||
        g.set_sort_defaults('date_time', 'desc')
 | 
			
		||||
 | 
			
		||||
        g.set_label('register_number', "Register")
 | 
			
		||||
        g.set_label('transaction_number', "Trans. No.")
 | 
			
		||||
        g.set_label('card_number', "Card No.")
 | 
			
		||||
        g.set_label('department_number', "Dept. No.")
 | 
			
		||||
 | 
			
		||||
        g.set_link('upc')
 | 
			
		||||
        g.set_link('description')
 | 
			
		||||
 | 
			
		||||
    def configure_form(self, f):
 | 
			
		||||
        super(TransactionDetailView, self).configure_form(f)
 | 
			
		||||
 | 
			
		||||
        f.set_type('date_time', 'datetime_local')
 | 
			
		||||
        f.set_type('quantity', 'quantity')
 | 
			
		||||
        f.set_type('unit_price', 'currency')
 | 
			
		||||
        f.set_type('discount', 'currency')
 | 
			
		||||
        f.set_type('total', 'currency')
 | 
			
		||||
 | 
			
		||||
    def import_square(self):
 | 
			
		||||
        return self.import_batch_from_file(FromSquareToCoreTrans, 'TransactionDetail',
 | 
			
		||||
                                           importer_host_title="Square CSV")
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def defaults(cls, config):
 | 
			
		||||
        route_prefix = cls.get_route_prefix()
 | 
			
		||||
        url_prefix = cls.get_url_prefix()
 | 
			
		||||
        permission_prefix = cls.get_permission_prefix()
 | 
			
		||||
 | 
			
		||||
        # import from square
 | 
			
		||||
        config.add_route('{}.import_square'.format(route_prefix), '{}/import-square'.format(url_prefix))
 | 
			
		||||
        config.add_view(cls, attr='import_square', route_name='{}.import_square'.format(route_prefix),
 | 
			
		||||
                        permission='{}.import_file'.format(permission_prefix))
 | 
			
		||||
 | 
			
		||||
        cls._defaults(config)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    TransactionDetailView.defaults(config)
 | 
			
		||||
							
								
								
									
										58
									
								
								tailbone_corepos/views/corepos/vendors.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								tailbone_corepos/views/corepos/vendors.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,58 @@
 | 
			
		|||
# -*- coding: utf-8; -*-
 | 
			
		||||
################################################################################
 | 
			
		||||
#
 | 
			
		||||
#  Rattail -- Retail Software Framework
 | 
			
		||||
#  Copyright © 2010-2019 Lance Edgar
 | 
			
		||||
#
 | 
			
		||||
#  This file is part of Rattail.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is free software: you can redistribute it and/or modify it under the
 | 
			
		||||
#  terms of the GNU General Public License as published by the Free Software
 | 
			
		||||
#  Foundation, either version 3 of the License, or (at your option) any later
 | 
			
		||||
#  version.
 | 
			
		||||
#
 | 
			
		||||
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 | 
			
		||||
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 | 
			
		||||
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 | 
			
		||||
#  details.
 | 
			
		||||
#
 | 
			
		||||
#  You should have received a copy of the GNU General Public License along with
 | 
			
		||||
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
"""
 | 
			
		||||
CORE-POS vendor views
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
from corepos.db import model as corepos
 | 
			
		||||
 | 
			
		||||
from .master import CoreOfficeMasterView
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class VendorView(CoreOfficeMasterView):
 | 
			
		||||
    """
 | 
			
		||||
    Base class for vendor views.
 | 
			
		||||
    """
 | 
			
		||||
    model_class = corepos.Vendor
 | 
			
		||||
    model_title = "CORE-POS Vendor"
 | 
			
		||||
    url_prefix = '/core-pos/vendors'
 | 
			
		||||
    route_prefix = 'corepos.vendors'
 | 
			
		||||
 | 
			
		||||
    labels = {
 | 
			
		||||
        'vendorID': "ID",
 | 
			
		||||
        'vendorName': "Name",
 | 
			
		||||
        'vendorAbbreviation': "Abbreviation",
 | 
			
		||||
        'discountRate': "Discount Rate",
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    grid_columns = [
 | 
			
		||||
        'vendorID',
 | 
			
		||||
        'vendorName',
 | 
			
		||||
        'vendorAbbreviation',
 | 
			
		||||
        'discountRate',
 | 
			
		||||
        'contact',
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def includeme(config):
 | 
			
		||||
    VendorView.defaults(config)
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue