Overhaul desktop views for receiving, for efficiency
still could use even more i'm sure, but this takes advantage of buefy to add dialogs etc. from the "view receiving batch row" page. this batch no longer allows direct edit of rows but that's hopefully for the better.
This commit is contained in:
parent
2f676774e9
commit
340a177a29
14 changed files with 1014 additions and 157 deletions
|
@ -99,8 +99,10 @@ class PurchasingBatchView(BatchMasterView):
|
|||
'upc': "UPC",
|
||||
'item_id': "Item ID",
|
||||
'brand_name': "Brand",
|
||||
'case_quantity': "Case Size",
|
||||
'po_line_number': "PO Line Number",
|
||||
'po_unit_cost': "PO Unit Cost",
|
||||
'po_case_size': "PO Case Size",
|
||||
'po_total': "PO Total",
|
||||
}
|
||||
|
||||
|
@ -144,6 +146,9 @@ class PurchasingBatchView(BatchMasterView):
|
|||
'mispick',
|
||||
'cases_mispick',
|
||||
'units_mispick',
|
||||
'missing',
|
||||
'cases_missing',
|
||||
'units_missing',
|
||||
'po_line_number',
|
||||
'po_unit_cost',
|
||||
'po_total',
|
||||
|
@ -710,8 +715,11 @@ class PurchasingBatchView(BatchMasterView):
|
|||
f.set_renderer('damaged', self.render_row_quantity)
|
||||
f.set_renderer('expired', self.render_row_quantity)
|
||||
f.set_renderer('mispick', self.render_row_quantity)
|
||||
f.set_renderer('missing', self.render_row_quantity)
|
||||
|
||||
f.set_type('case_quantity', 'quantity')
|
||||
f.set_type('po_case_size', 'quantity')
|
||||
f.set_type('invoice_case_size', 'quantity')
|
||||
f.set_type('cases_ordered', 'quantity')
|
||||
f.set_type('units_ordered', 'quantity')
|
||||
f.set_type('cases_shipped', 'quantity')
|
||||
|
@ -724,6 +732,8 @@ class PurchasingBatchView(BatchMasterView):
|
|||
f.set_type('units_expired', 'quantity')
|
||||
f.set_type('cases_mispick', 'quantity')
|
||||
f.set_type('units_mispick', 'quantity')
|
||||
f.set_type('cases_missing', 'quantity')
|
||||
f.set_type('units_missing', 'quantity')
|
||||
|
||||
# currency fields
|
||||
# nb. we only show "total" fields as currency, but not case or
|
||||
|
@ -746,7 +756,8 @@ class PurchasingBatchView(BatchMasterView):
|
|||
|
||||
# credits
|
||||
f.set_readonly('credits')
|
||||
f.set_renderer('credits', self.render_row_credits)
|
||||
if self.viewing:
|
||||
f.set_renderer('credits', self.render_row_credits)
|
||||
|
||||
if self.creating:
|
||||
f.remove_fields(
|
||||
|
@ -786,36 +797,58 @@ class PurchasingBatchView(BatchMasterView):
|
|||
app = self.get_rattail_app()
|
||||
cases = getattr(row, 'cases_{}'.format(field))
|
||||
units = getattr(row, 'units_{}'.format(field))
|
||||
if cases and units:
|
||||
return "{} cases + {} units".format(app.render_quantity(cases),
|
||||
app.render_quantity(units))
|
||||
if cases and not units:
|
||||
return "{} cases".format(app.render_quantity(cases))
|
||||
if units and not cases:
|
||||
return "{} units".format(app.render_quantity(units))
|
||||
|
||||
def render_row_credits(self, row, field):
|
||||
if not row.credits:
|
||||
return ""
|
||||
return app.render_cases_units(cases, units)
|
||||
|
||||
def make_row_credits_grid(self, row):
|
||||
use_buefy = self.get_use_buefy()
|
||||
route_prefix = self.get_route_prefix()
|
||||
columns = [
|
||||
'credit_type',
|
||||
'cases_shorted',
|
||||
'units_shorted',
|
||||
'credit_total',
|
||||
]
|
||||
g = grids.Grid(
|
||||
factory = self.get_grid_factory()
|
||||
|
||||
g = factory(
|
||||
key='{}.row_credits'.format(route_prefix),
|
||||
data=row.credits,
|
||||
columns=columns,
|
||||
labels={'credit_type': "Type",
|
||||
'cases_shorted': "Cases",
|
||||
'units_shorted': "Units"})
|
||||
data=[] if use_buefy else row.credits,
|
||||
columns=[
|
||||
'credit_type',
|
||||
# 'cases_shorted',
|
||||
# 'units_shorted',
|
||||
'shorted',
|
||||
'credit_total',
|
||||
'expiration_date',
|
||||
# 'mispick_upc',
|
||||
# 'mispick_brand_name',
|
||||
# 'mispick_description',
|
||||
# 'mispick_size',
|
||||
],
|
||||
labels={
|
||||
'credit_type': "Type",
|
||||
'cases_shorted': "Cases",
|
||||
'units_shorted': "Units",
|
||||
'shorted': "Quantity",
|
||||
'credit_total': "Total",
|
||||
'mispick_upc': "Mispick UPC",
|
||||
'mispick_brand_name': "MP Brand",
|
||||
'mispick_description': "MP Description",
|
||||
'mispick_size': "MP Size",
|
||||
})
|
||||
|
||||
g.set_type('cases_shorted', 'quantity')
|
||||
g.set_type('units_shorted', 'quantity')
|
||||
g.set_type('credit_total', 'currency')
|
||||
return HTML.literal(g.render_grid())
|
||||
|
||||
return g
|
||||
|
||||
def render_row_credits(self, row, field):
|
||||
use_buefy = self.get_use_buefy()
|
||||
if not use_buefy and not row.credits:
|
||||
return
|
||||
|
||||
g = self.make_row_credits_grid(row)
|
||||
|
||||
if use_buefy:
|
||||
return HTML.literal(
|
||||
g.render_buefy_table_element(data_prop='rowData.credits'))
|
||||
else:
|
||||
return HTML.literal(g.render_grid())
|
||||
|
||||
# def item_lookup(self, value, field=None):
|
||||
# """
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue