Changeset 3760c32 in tailbone


Ignore:
Timestamp:
03/07/19 12:21:50 (5 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
d337def
Parents:
4a9b528
Message:

Improve display of purchase credit data

esp. within a receiving batch row

Location:
tailbone/views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tailbone/views/purchases/credits.py

    r4a9b528 r3760c32  
    33#
    44#  Rattail -- Retail Software Framework
    5 #  Copyright © 2010-2018 Lance Edgar
     5#  Copyright © 2010-2019 Lance Edgar
    66#
    77#  This file is part of Rattail.
     
    4848    checkboxes = True
    4949
     50    labels = {
     51        'upc': "UPC",
     52        'mispick_upc': "Mispick UPC",
     53    }
     54
    5055    grid_columns = [
    5156        'vendor',
     
    6368        'mispick_upc',
    6469        'date_received',
     70        'status',
     71    ]
     72
     73    form_fields = [
     74        'store',
     75        'vendor',
     76        'invoice_number',
     77        'invoice_date',
     78        'date_ordered',
     79        'date_shipped',
     80        'date_received',
     81        'department_number',
     82        'department_name',
     83        'vendor_item_code',
     84        'upc',
     85        'product',
     86        'case_quantity',
     87        'credit_type',
     88        'cases_shorted',
     89        'units_shorted',
     90        'invoice_line_number',
     91        'invoice_case_cost',
     92        'invoice_unit_cost',
     93        'invoice_total',
     94        'credit_total',
     95        'mispick_upc',
     96        'mispick_product',
     97        'product_discarded',
     98        'expiration_date',
    6599        'status',
    66100    ]
     
    87121
    88122        g.set_label('invoice_number', "Invoice No.")
    89         g.set_label('upc', "UPC")
    90123        g.set_label('vendor_item_code', "Item Code")
    91124        g.set_label('brand_name', "Brand")
     
    93126        g.set_label('units_shorted', "Units")
    94127        g.set_label('credit_type', "Type")
    95         g.set_label('mispick_upc', "Mispick UPC")
    96128        g.set_label('date_received', "Date")
     129
     130        g.set_link('upc')
     131        g.set_link('vendor_item_code')
     132        g.set_link('brand_name')
     133        g.set_link('description')
     134
     135    def configure_form(self, f):
     136        super(PurchaseCreditView, self).configure_form(f)
     137
     138        # status
     139        f.set_enum('status', self.enum.PURCHASE_CREDIT_STATUS)
    97140
    98141    def change_status(self):
  • tailbone/views/purchasing/batch.py

    r4a9b528 r3760c32  
    33#
    44#  Rattail -- Retail Software Framework
    5 #  Copyright © 2010-2018 Lance Edgar
     5#  Copyright © 2010-2019 Lance Edgar
    66#
    77#  This file is part of Rattail.
     
    3535from deform import widget as dfwidget
    3636from pyramid import httpexceptions
    37 from webhelpers2.html import tags
    38 
    39 from tailbone import forms
     37from webhelpers2.html import tags, HTML
     38
     39from tailbone import forms, grids
    4040from tailbone.views.batch import BatchMasterView
    4141
     
    647647        # readonly fields
    648648        f.set_readonly('case_quantity')
    649         f.set_readonly('credits')
    650649
    651650        # quantity fields
     
    670669        # upc
    671670        f.set_type('upc', 'gpc')
     671
     672        # credits
     673        f.set_readonly('credits')
     674        f.set_renderer('credits', self.render_row_credits)
    672675
    673676        if self.creating:
     
    704707            else:
    705708                f.remove_field('product')
     709
     710    def render_row_credits(self, row, field):
     711        if not row.credits:
     712            return ""
     713
     714        route_prefix = self.get_route_prefix()
     715        columns = [
     716            'credit_type',
     717            'cases_shorted',
     718            'units_shorted',
     719            'credit_total',
     720        ]
     721        g = grids.Grid(
     722            key='{}.row_credits'.format(route_prefix),
     723            data=row.credits,
     724            columns=columns,
     725            labels={'credit_type': "Type",
     726                    'cases_shorted': "Cases",
     727                    'units_shorted': "Units"})
     728        g.set_type('cases_shorted', 'quantity')
     729        g.set_type('units_shorted', 'quantity')
     730        g.set_type('credit_total', 'currency')
     731        return HTML.literal(g.render_grid())
    706732
    707733    def configure_mobile_row_form(self, f):
Note: See TracChangeset for help on using the changeset viewer.