fix: add "other" menu entry, plus docs/tests
This commit is contained in:
parent
ce54ca6bd6
commit
c2f76f6c97
20 changed files with 546 additions and 15 deletions
|
@ -34,8 +34,9 @@ from sideshow.batch import neworder as base
|
|||
|
||||
class NewOrderBatchHandler(base.NewOrderBatchHandler):
|
||||
"""
|
||||
Custom batch handler which can use CORE-POS as external data
|
||||
source for customers and products.
|
||||
Custom :term:`handler` for :term:`new order batches <new order
|
||||
batch>` which can use CORE-POS as external data source for
|
||||
customers and products.
|
||||
|
||||
See parent class
|
||||
:class:`~sideshow:sideshow.batch.neworder.NewOrderBatchHandler`
|
||||
|
@ -96,7 +97,7 @@ class NewOrderBatchHandler(base.NewOrderBatchHandler):
|
|||
.options(orm.joinedload(op_model.CustomerClassic.member_info))\
|
||||
.one()
|
||||
except orm.exc.NoResultFound:
|
||||
raise ValueError(f"CORE-POS Customer not found: {customer_id}")
|
||||
raise ValueError(f"CORE-POS Customer not found: {batch.customer_id}")
|
||||
|
||||
batch.customer_name = str(customer)
|
||||
batch.phone_number = customer.member_info.phone
|
||||
|
@ -132,19 +133,16 @@ class NewOrderBatchHandler(base.NewOrderBatchHandler):
|
|||
# get results
|
||||
def result(product):
|
||||
return {'value': product.upc,
|
||||
'label': product.formatted_name}
|
||||
'label': self.app.make_full_name(product.brand,
|
||||
product.description,
|
||||
product.size)}
|
||||
results = [result(c) for c in products]
|
||||
|
||||
op_session.close()
|
||||
return results
|
||||
|
||||
def get_product_info_external(self, session, product_id, user=None):
|
||||
"""
|
||||
Returns basic info for an :term:`external product` as pertains
|
||||
to ordering.
|
||||
|
||||
There is no default logic here; subclass must implement.
|
||||
"""
|
||||
""" """
|
||||
corepos = self.app.get_corepos_handler()
|
||||
op_model = corepos.get_model_office_op()
|
||||
op_session = corepos.make_session_office_op()
|
||||
|
@ -162,7 +160,6 @@ class NewOrderBatchHandler(base.NewOrderBatchHandler):
|
|||
'brand_name': product.brand,
|
||||
'description': product.description,
|
||||
'size': product.size,
|
||||
# 'full_description': product.formatted_name,
|
||||
'full_description': self.app.make_full_name(product.brand,
|
||||
product.description,
|
||||
product.size),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue