Misc. tweaks for CORE product, batch views
This commit is contained in:
parent
c81e5a52cd
commit
f3a49838c1
|
@ -1,5 +1,5 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/core-pos/master/view.mako" />
|
||||
<%inherit file="/master/view.mako" />
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
${parent.modify_this_page_vars()}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -87,8 +87,13 @@ class BatchView(CoreOfficeMasterView):
|
|||
'id',
|
||||
'name',
|
||||
'batch_type',
|
||||
'discount_type',
|
||||
'priority',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'owner',
|
||||
'trans_limit',
|
||||
'notes',
|
||||
]
|
||||
|
||||
row_labels = {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -134,7 +134,7 @@ class ProductView(CoreOfficeMasterView):
|
|||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(ProductView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
|
||||
g.set_joiner('department', lambda q: q.outerjoin(corepos.Department))
|
||||
g.set_sorter('department', corepos.Department.name)
|
||||
|
@ -167,7 +167,7 @@ class ProductView(CoreOfficeMasterView):
|
|||
return "{} {}".format(product.upc, product.description)
|
||||
|
||||
def configure_form(self, f):
|
||||
super(ProductView, self).configure_form(f)
|
||||
super().configure_form(f)
|
||||
|
||||
if not table_exists(self.Session(), corepos.FloorSection):
|
||||
f.remove('physical_location')
|
||||
|
@ -266,7 +266,7 @@ class ProductView(CoreOfficeMasterView):
|
|||
g.render_buefy_table_element(data_prop='vendorItemsData'))
|
||||
|
||||
def template_kwargs_view(self, **kwargs):
|
||||
kwargs = super(ProductView, self).template_kwargs_view(**kwargs)
|
||||
kwargs = super().template_kwargs_view(**kwargs)
|
||||
product = kwargs['instance']
|
||||
app = self.get_rattail_app()
|
||||
|
||||
|
@ -283,19 +283,22 @@ class ProductView(CoreOfficeMasterView):
|
|||
|
||||
return kwargs
|
||||
|
||||
def core_office_object_url(self, office_url, product):
|
||||
return '{}/item/ItemEditorPage.php?searchupc={}'.format(
|
||||
office_url, product.upc)
|
||||
def get_xref_buttons(self, product):
|
||||
app = self.get_rattail_app()
|
||||
corepos = app.get_corepos_handler()
|
||||
url = corepos.get_office_product_url(product.upc)
|
||||
if url:
|
||||
return [self.make_xref_button(url=url, text="View in CORE Office")]
|
||||
|
||||
def download_results_fields_available(self, **kwargs):
|
||||
fields = super(ProductView, self).download_results_fields_available(**kwargs)
|
||||
fields = super().download_results_fields_available(**kwargs)
|
||||
|
||||
fields.append('superdepartment_number')
|
||||
|
||||
return fields
|
||||
|
||||
def download_results_setup(self, fields, progress=None):
|
||||
super(ProductView, self).download_results_setup(fields, progress=progress)
|
||||
super().download_results_setup(fields, progress=progress)
|
||||
|
||||
if 'superdepartment_number' in fields:
|
||||
mapping = {}
|
||||
|
@ -309,7 +312,7 @@ class ProductView(CoreOfficeMasterView):
|
|||
self.supermap = mapping
|
||||
|
||||
def download_results_normalize(self, product, fields, **kwargs):
|
||||
data = super(ProductView, self).download_results_normalize(product, fields, **kwargs)
|
||||
data = super().download_results_normalize(product, fields, **kwargs)
|
||||
|
||||
if 'superdepartment_number' in fields:
|
||||
data['superdepartment_number'] = None
|
||||
|
@ -356,7 +359,7 @@ class ProductUserView(CoreOfficeMasterView):
|
|||
]
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(ProductUserView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
|
||||
g.filters['upc'].default_active = True
|
||||
g.filters['upc'].default_verb = 'contains'
|
||||
|
@ -367,7 +370,7 @@ class ProductUserView(CoreOfficeMasterView):
|
|||
g.set_link('description')
|
||||
|
||||
def configure_form(self, f):
|
||||
super(ProductUserView, self).configure_form(f)
|
||||
super().configure_form(f)
|
||||
|
||||
f.set_type('long_text', 'text')
|
||||
f.set_renderer('product', self.render_corepos_product)
|
||||
|
@ -383,7 +386,7 @@ class ProductFlagView(CoreOfficeMasterView):
|
|||
route_prefix = 'corepos.product_flags'
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(ProductFlagView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
|
||||
g.set_link('bit_number')
|
||||
g.set_link('description')
|
||||
|
|
Loading…
Reference in a new issue