Refactor some label printing stuff, per rattail changes.

This had to do with some edbob removal.
This commit is contained in:
Lance Edgar 2014-09-13 19:15:40 -07:00
parent 03c72d850d
commit 9d2a35c8b1
2 changed files with 12 additions and 9 deletions

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2012 Lance Edgar
# Copyright © 2010-2014 Lance Edgar
#
# This file is part of Rattail.
#
@ -26,10 +25,12 @@
Print Labels Batch
"""
from ....db import Session
from __future__ import unicode_literals
import rattail
from . import BatchParamsView
from rattail.db import model
from tailbone.db import Session
from tailbone.views.batches.params import BatchParamsView
class PrintLabels(BatchParamsView):
@ -37,8 +38,8 @@ class PrintLabels(BatchParamsView):
provider_name = 'print_labels'
def render_kwargs(self):
q = Session.query(rattail.LabelProfile)
q = q.order_by(rattail.LabelProfile.ordinal)
q = Session.query(model.LabelProfile)
q = q.order_by(model.LabelProfile.ordinal)
profiles = [(x.code, x.description) for x in q]
return {'label_profiles': profiles}

View file

@ -25,6 +25,8 @@
Product Views
"""
from __future__ import unicode_literals
import os
from sqlalchemy import and_
@ -326,7 +328,7 @@ def print_labels(request):
return {'error': "Quantity must be numeric"}
quantity = int(quantity)
printer = profile.get_printer()
printer = profile.get_printer(request.rattail_config)
if not printer:
return {'error': "Couldn't get printer from label profile"}