Add UI support for Product.last_sold
and current_price_ends
pseudo-field.
This commit is contained in:
parent
42da24a047
commit
3fed317805
|
@ -33,6 +33,7 @@
|
||||||
<%def name="render_price_fields(form)">
|
<%def name="render_price_fields(form)">
|
||||||
${render_field_readonly(form.fieldset.regular_price)}
|
${render_field_readonly(form.fieldset.regular_price)}
|
||||||
${render_field_readonly(form.fieldset.current_price)}
|
${render_field_readonly(form.fieldset.current_price)}
|
||||||
|
${render_field_readonly(form.fieldset.current_price_ends)}
|
||||||
${render_field_readonly(form.fieldset.deposit_link)}
|
${render_field_readonly(form.fieldset.deposit_link)}
|
||||||
${render_field_readonly(form.fieldset.tax)}
|
${render_field_readonly(form.fieldset.tax)}
|
||||||
</%def>
|
</%def>
|
||||||
|
@ -46,6 +47,10 @@
|
||||||
${render_field_readonly(form.fieldset.deleted)}
|
${render_field_readonly(form.fieldset.deleted)}
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
<%def name="render_movement_fields(form)">
|
||||||
|
${render_field_readonly(form.fieldset.last_sold)}
|
||||||
|
</%def>
|
||||||
|
|
||||||
<div class="form-wrapper">
|
<div class="form-wrapper">
|
||||||
<ul class="context-menu">
|
<ul class="context-menu">
|
||||||
${self.context_menu_items()}
|
${self.context_menu_items()}
|
||||||
|
@ -96,6 +101,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<h2>Movement</h2>
|
||||||
|
<div class="panel-body">
|
||||||
|
${self.render_movement_fields(form)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="panel-grid" id="product-costs">
|
<div class="panel-grid" id="product-costs">
|
||||||
<h2>Vendor Sources</h2>
|
<h2>Vendor Sources</h2>
|
||||||
<div class="grid full hoverable no-border">
|
<div class="grid full hoverable no-border">
|
||||||
|
|
|
@ -32,8 +32,8 @@ import re
|
||||||
from sqlalchemy import and_
|
from sqlalchemy import and_
|
||||||
from sqlalchemy.orm import joinedload, aliased
|
from sqlalchemy.orm import joinedload, aliased
|
||||||
|
|
||||||
|
import formalchemy
|
||||||
from webhelpers.html.tags import link_to
|
from webhelpers.html.tags import link_to
|
||||||
|
|
||||||
from pyramid.httpexceptions import HTTPFound
|
from pyramid.httpexceptions import HTTPFound
|
||||||
from pyramid.renderers import render_to_response
|
from pyramid.renderers import render_to_response
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ from rattail.pod import get_image_url, get_image_path
|
||||||
|
|
||||||
from tailbone.views import SearchableAlchemyGridView, CrudView
|
from tailbone.views import SearchableAlchemyGridView, CrudView
|
||||||
from tailbone.views.continuum import VersionView, version_defaults
|
from tailbone.views.continuum import VersionView, version_defaults
|
||||||
from tailbone.forms import EnumFieldRenderer
|
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.progress import SessionProgress
|
from tailbone.progress import SessionProgress
|
||||||
|
@ -249,6 +249,12 @@ class ProductCrud(CrudView):
|
||||||
fs.unit_of_measure.set(renderer=EnumFieldRenderer(enum.UNIT_OF_MEASURE))
|
fs.unit_of_measure.set(renderer=EnumFieldRenderer(enum.UNIT_OF_MEASURE))
|
||||||
fs.regular_price.set(renderer=PriceFieldRenderer)
|
fs.regular_price.set(renderer=PriceFieldRenderer)
|
||||||
fs.current_price.set(renderer=PriceFieldRenderer)
|
fs.current_price.set(renderer=PriceFieldRenderer)
|
||||||
|
|
||||||
|
fs.append(formalchemy.Field('current_price_ends'))
|
||||||
|
fs.current_price_ends.set(value=lambda p: p.current_price.ends if p.current_price else None)
|
||||||
|
fs.current_price_ends.set(renderer=DateTimeFieldRenderer(self.request.rattail_config))
|
||||||
|
|
||||||
|
fs.last_sold.set(renderer=DateTimeFieldRenderer(self.request.rattail_config))
|
||||||
fs.configure(
|
fs.configure(
|
||||||
include=[
|
include=[
|
||||||
fs.upc.label("UPC"),
|
fs.upc.label("UPC"),
|
||||||
|
@ -266,6 +272,7 @@ class ProductCrud(CrudView):
|
||||||
fs.report_code,
|
fs.report_code,
|
||||||
fs.regular_price,
|
fs.regular_price,
|
||||||
fs.current_price,
|
fs.current_price,
|
||||||
|
fs.current_price_ends,
|
||||||
fs.deposit_link,
|
fs.deposit_link,
|
||||||
fs.tax,
|
fs.tax,
|
||||||
fs.organic,
|
fs.organic,
|
||||||
|
@ -273,6 +280,7 @@ class ProductCrud(CrudView):
|
||||||
fs.special_order,
|
fs.special_order,
|
||||||
fs.not_for_sale,
|
fs.not_for_sale,
|
||||||
fs.deleted,
|
fs.deleted,
|
||||||
|
fs.last_sold,
|
||||||
])
|
])
|
||||||
if not self.readonly:
|
if not self.readonly:
|
||||||
del fs.regular_price
|
del fs.regular_price
|
||||||
|
|
Loading…
Reference in a new issue