Add dept. number and friends to product details page.
This commit is contained in:
parent
8a21fe7cfc
commit
84c5f0a327
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2014 Lance Edgar
|
# Copyright © 2010-2015 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -72,6 +72,39 @@ class GPCFieldRenderer(TextFieldRenderer):
|
||||||
return '{0}-{1}'.format(gpc[:-1], gpc[-1])
|
return '{0}-{1}'.format(gpc[:-1], gpc[-1])
|
||||||
|
|
||||||
|
|
||||||
|
class DepartmentFieldRenderer(TextFieldRenderer):
|
||||||
|
"""
|
||||||
|
Shows the department number as well as the name.
|
||||||
|
"""
|
||||||
|
def render_readonly(self, **kwargs):
|
||||||
|
dept = self.raw_value
|
||||||
|
if dept:
|
||||||
|
return "{0} {1}".format(dept.number, dept.name)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
class SubdepartmentFieldRenderer(TextFieldRenderer):
|
||||||
|
"""
|
||||||
|
Shows the subdepartment number as well as the name.
|
||||||
|
"""
|
||||||
|
def render_readonly(self, **kwargs):
|
||||||
|
sub = self.raw_value
|
||||||
|
if sub:
|
||||||
|
return "{0} {1}".format(sub.number, sub.name)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
class CategoryFieldRenderer(TextFieldRenderer):
|
||||||
|
"""
|
||||||
|
Shows the category number as well as the name.
|
||||||
|
"""
|
||||||
|
def render_readonly(self, **kwargs):
|
||||||
|
cat = self.raw_value
|
||||||
|
if cat:
|
||||||
|
return "{0} {1}".format(cat.number, cat.name)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
class BrandFieldRenderer(AutocompleteFieldRenderer):
|
class BrandFieldRenderer(AutocompleteFieldRenderer):
|
||||||
"""
|
"""
|
||||||
Renderer for :class:`rattail.db.model.Brand` instance fields.
|
Renderer for :class:`rattail.db.model.Brand` instance fields.
|
||||||
|
|
|
@ -57,6 +57,7 @@ from tailbone.views.continuum import VersionView, version_defaults
|
||||||
from tailbone.forms import EnumFieldRenderer, DateTimeFieldRenderer
|
from tailbone.forms import EnumFieldRenderer, DateTimeFieldRenderer
|
||||||
from tailbone.db import Session
|
from tailbone.db import Session
|
||||||
from tailbone.forms import GPCFieldRenderer, BrandFieldRenderer, PriceFieldRenderer
|
from tailbone.forms import GPCFieldRenderer, BrandFieldRenderer, PriceFieldRenderer
|
||||||
|
from tailbone.forms.renderers import products as forms
|
||||||
from tailbone.progress import SessionProgress
|
from tailbone.progress import SessionProgress
|
||||||
|
|
||||||
|
|
||||||
|
@ -267,9 +268,9 @@ class ProductCrud(CrudView):
|
||||||
fs.size,
|
fs.size,
|
||||||
fs.weighed,
|
fs.weighed,
|
||||||
fs.case_pack,
|
fs.case_pack,
|
||||||
fs.department,
|
fs.department.with_renderer(forms.DepartmentFieldRenderer),
|
||||||
fs.subdepartment,
|
fs.subdepartment.with_renderer(forms.SubdepartmentFieldRenderer),
|
||||||
fs.category,
|
fs.category.with_renderer(forms.CategoryFieldRenderer),
|
||||||
fs.family,
|
fs.family,
|
||||||
fs.report_code,
|
fs.report_code,
|
||||||
fs.regular_price,
|
fs.regular_price,
|
||||||
|
|
Loading…
Reference in a new issue