Tweak the Ordering Worksheet generator, per Buefy

This commit is contained in:
Lance Edgar 2023-01-30 11:46:07 -06:00
parent b7f3a67cd0
commit a3723e4879
3 changed files with 18 additions and 4 deletions

View file

@ -1,3 +1,4 @@
## -*- coding: utf-8 -*-
<%inherit file="/base.mako" />
## -*- coding: utf-8; -*-
<%inherit file="/page.mako" />
${parent.body()}

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@ -218,6 +218,19 @@ class DepartmentView(MasterView):
.distinct()\
.order_by(model.Department.name)
if self.get_use_buefy():
def normalize(dept):
return {
'uuid': dept.uuid,
'number': dept.number,
'name': dept.name,
}
return self.json_response([normalize(d) for d in data])
# nb. the rest of this is legacy / not buefy
def configure(g):
g.configure(include=[
g.name,

View file

@ -101,7 +101,7 @@ class OrderingWorksheet(View):
response.headers['Content-Disposition'] = 'attachment; filename=ordering.html'
response.text = body
return response
return {}
return {'use_buefy': self.get_use_buefy()}
def write_report(self, vendor, departments, preferred_only):
"""