Add uom fields, configurable template for newproduct batch

This commit is contained in:
Lance Edgar 2022-08-30 10:58:13 -05:00
parent 6ea8a02b57
commit bb4e98af8d
3 changed files with 41 additions and 6 deletions

Binary file not shown.

View file

@ -0,0 +1,9 @@
## -*- coding: utf-8; -*-
<%inherit file="/configure.mako" />
<%def name="form_content()">
${self.input_file_templates_section()}
</%def>
${parent.body()}

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2021 Lance Edgar
# Copyright © 2010-2022 Lance Edgar
#
# This file is part of Rattail.
#
@ -46,6 +46,9 @@ class NewProductBatchView(BatchMasterView):
rows_editable = True
rows_bulk_deletable = True
configurable = True
has_input_file_templates = True
form_fields = [
'id',
'input_filename',
@ -64,14 +67,14 @@ class NewProductBatchView(BatchMasterView):
row_grid_columns = [
'sequence',
'upc',
'_product_key_',
'brand_name',
'description',
'size',
'vendor',
'vendor_item_code',
'department',
'subdepartment',
'department_name',
'subdepartment_name',
'regular_price',
'status_code',
]
@ -79,16 +82,20 @@ class NewProductBatchView(BatchMasterView):
row_form_fields = [
'sequence',
'product',
'upc',
'_product_key_',
'brand_name',
'description',
'size',
'unit_size',
'unit_of_measure_entry',
'vendor_id',
'vendor',
'vendor_item_code',
'department_number',
'department_name',
'department',
'subdepartment_number',
'subdepartment_name',
'subdepartment',
'case_size',
'case_cost',
@ -108,6 +115,14 @@ class NewProductBatchView(BatchMasterView):
'status_text',
]
def get_input_file_templates(self):
return [
{'key': 'default',
'label': "Default",
'default_url': self.request.static_url(
'tailbone:static/files/newproduct_template.xlsx')},
]
def configure_form(self, f):
super(NewProductBatchView, self).configure_form(f)
@ -127,6 +142,10 @@ class NewProductBatchView(BatchMasterView):
g.set_type('pack_price', 'currency')
g.set_type('suggested_price', 'currency')
g.set_link('brand_name')
g.set_link('description')
g.set_link('size')
def row_grid_extra_class(self, row, i):
if row.status_code in (row.STATUS_MISSING_KEY,
row.STATUS_PRODUCT_EXISTS,
@ -159,5 +178,12 @@ class NewProductBatchView(BatchMasterView):
f.set_renderer('report', self.render_report)
def includeme(config):
def defaults(config, **kwargs):
base = globals()
NewProductBatchView = kwargs.get('NewProductBatchView', base['NewProductBatchView'])
NewProductBatchView.defaults(config)
def includeme(config):
defaults(config)